javaprojects.gradle 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. apply plugin: 'java'
  2. apply plugin: 'eclipse'
  3. sourceCompatibility = 1.5
  4. targetCompatibility = 1.5
  5. ext.springVersion = '3.0.7.RELEASE'
  6. ext.springLdapVersion = '1.3.1.RELEASE'
  7. ext.ehcacheVersion = '1.6.2'
  8. ext.aspectjVersion = '1.6.10'
  9. ext.apacheDsVersion = '1.5.5'
  10. ext.jstlVersion = '1.2'
  11. ext.jettyVersion = '6.1.26'
  12. ext.hsqlVersion = '1.8.0.10'
  13. ext.slf4jVersion = '1.6.1'
  14. ext.logbackVersion = '0.9.29'
  15. ext.cglibVersion = '2.2'
  16. ext.powerMockVersion = '1.4.12'
  17. ext.bundlorProperties = [
  18. version: version,
  19. secRange: "[$version, 3.2.0)",
  20. springRange: "[$springVersion, 3.2.0)",
  21. aspectjRange: '[1.6.0, 1.7.0)',
  22. casRange: '[3.1.1, 3.2.0)',
  23. cloggingRange: '[1.0.4, 2.0.0)',
  24. ehcacheRange: '[1.4.1, 2.5.0)',
  25. openid4javaRange: '[0.9.5, 1.0.0)',
  26. springLdapRange: '[1.3.0,1.4.0)',
  27. apacheDSRange: '[1.5.5, 1.6)',
  28. apacheDSSharedRange: '[0.9.15, 1.0)',
  29. ldapSdkRange: '[4.1, 5.0)',
  30. aopAllianceRange: '[1.0.0, 2.0.0)'
  31. ]
  32. configurations {
  33. // Configuration which is ONLY used for compileJava and will not be inherited by any others
  34. // Revisit post Gradle 1.0
  35. compileOnly
  36. // Used to identify deps which should be marked as "provided" in maven poms
  37. provided
  38. testCompile.extendsFrom provided
  39. compile.transitive = false
  40. testCompile.transitive = false
  41. }
  42. // Integration test setup
  43. configurations {
  44. integrationTestCompile {
  45. extendsFrom testCompile
  46. }
  47. integrationTestRuntime {
  48. extendsFrom integrationTestCompile, testRuntime
  49. }
  50. }
  51. sourceSets {
  52. integrationTest {
  53. java.srcDir file('src/integration-test/java')
  54. resources.srcDir file('src/integration-test/resources')
  55. compileClasspath = sourceSets.main.output + sourceSets.test.output + configurations.integrationTestCompile
  56. runtimeClasspath = output + compileClasspath + configurations.integrationTestRuntime
  57. }
  58. }
  59. task integrationTest(type: Test, dependsOn: jar) {
  60. testClassesDir = sourceSets.integrationTest.output.classesDir
  61. logging.captureStandardOutput(LogLevel.INFO)
  62. classpath = sourceSets.integrationTest.runtimeClasspath
  63. maxParallelForks = 1
  64. testReport = false
  65. }
  66. dependencies {
  67. compileOnly 'commons-logging:commons-logging:1.1.1'
  68. compile ("org.springframework:spring-core:$springVersion") {
  69. exclude(group: 'commons-logging', module: 'commons-logging')
  70. }
  71. testCompile 'junit:junit:4.7',
  72. 'org.mockito:mockito-core:1.8.5',
  73. "org.springframework:spring-test:$springVersion"
  74. // Use slf4j/logback for logging
  75. testRuntime "org.slf4j:jcl-over-slf4j:$slf4jVersion",
  76. "ch.qos.logback:logback-classic:$logbackVersion"
  77. }
  78. [configurations.runtime, configurations.default]*.exclude(module: 'commons-logging')
  79. sourceSets.main.compileClasspath += configurations.compileOnly
  80. sourceSets.main.compileClasspath += configurations.provided
  81. [compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
  82. test {
  83. jvmArgs = ['-ea', '-Xmx500m']
  84. maxParallelForks = guessMaxForks()
  85. logging.captureStandardOutput(LogLevel.INFO)
  86. testReport = false
  87. }
  88. def guessMaxForks() {
  89. int processors = Runtime.runtime.availableProcessors()
  90. return Math.max(2, (int) (processors / 2))
  91. }