javaprojects.gradle 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. import java.util.jar.Manifest
  2. import org.gradle.api.tasks.bundling.GradleManifest
  3. apply id: 'java'
  4. springVersion = '3.0.1.RELEASE'
  5. springLdapVersion = '1.3.0.RELEASE'
  6. ehcacheVersion = '1.6.2'
  7. aspectjVersion = '1.6.8'
  8. apacheDsVersion = '1.5.5'
  9. jstlVersion = '1.1.2'
  10. jettyVersion = '6.1.22'
  11. hsqlVersion = '1.8.0.10'
  12. configurations {
  13. bundlor
  14. provided
  15. compile.extendsFrom provided
  16. }
  17. dependencies {
  18. compile 'commons-logging:commons-logging:1.1.1'
  19. compile ("org.springframework:spring-core:$springVersion") {
  20. exclude(group: 'commons-logging', module: 'commons-logging')
  21. }
  22. testCompile 'junit:junit:4.7',
  23. 'org.mockito:mockito-core:1.7',
  24. 'org.jmock:jmock:2.5.1',
  25. 'org.jmock:jmock-junit4:2.5.1',
  26. 'org.hamcrest:hamcrest-core:1.1',
  27. 'org.hamcrest:hamcrest-library:1.1',
  28. "org.springframework:spring-test:$springVersion"
  29. bundlor 'com.springsource.bundlor:com.springsource.bundlor.ant:1.0.0.RELEASE',
  30. 'com.springsource.bundlor:com.springsource.bundlor:1.0.0.RELEASE',
  31. 'com.springsource.bundlor:com.springsource.bundlor.blint:1.0.0.RELEASE'
  32. }
  33. test {
  34. onlyIf {
  35. !project.hasProperty('skipTests')
  36. }
  37. jvmArgs = ['-ea', '-Xms128m', '-Xmx500m', '-XX:MaxPermSize=128m']
  38. }
  39. task bundlor(dependsOn: compileJava) {
  40. onlyIf {
  41. dependsOnTaskDidWork()
  42. }
  43. doFirst {
  44. ant.taskdef(resource: 'com/springsource/bundlor/ant/antlib.xml', classpath: configurations.bundlor.asPath)
  45. File template = new File(projectDir, 'template.mf')
  46. mkdir(buildDir, 'bundlor')
  47. if (template.exists()) {
  48. ant.bundlor(inputPath: sourceSets.main.classesDir, outputPath: "$buildDir/bundlor", manifestTemplatePath: template) {
  49. property(name: 'version', value: "$version")
  50. property(name: 'spring.version', value: "$springVersion")
  51. }
  52. // See GRADLE-395 for support for using an existing manifest
  53. jar.manifest = new GradleManifest(new Manifest(new File("$buildDir/bundlor/META-INF/MANIFEST.MF").newInputStream()))
  54. }
  55. }
  56. }
  57. jar.dependsOn bundlor