javaprojects.gradle 3.0 KB

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