javaprojects.gradle 3.1 KB

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