javaprojects.gradle 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. apply plugin: 'java'
  2. apply plugin: 'eclipse'
  3. sourceCompatibility = 1.5
  4. targetCompatibility = 1.5
  5. ext.springVersion = '3.2.0.BUILD-SNAPSHOT'
  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.powerMockDependencies = [
  18. "org.powermock:powermock-core:$powerMockVersion",
  19. "org.powermock:powermock-api-support:$powerMockVersion",
  20. "org.powermock:powermock-module-junit4-common:$powerMockVersion",
  21. "org.powermock:powermock-module-junit4:$powerMockVersion",
  22. "org.powermock:powermock-api-mockito:$powerMockVersion",
  23. "org.powermock:powermock-reflect:$powerMockVersion"
  24. ]
  25. ext.bundlorProperties = [
  26. version: version,
  27. secRange: "[$version, 3.2.0)",
  28. springRange: "[$springVersion, 3.2.0)",
  29. aspectjRange: '[1.6.0, 1.7.0)',
  30. casRange: '[3.1.1, 3.2.0)',
  31. cloggingRange: '[1.0.4, 2.0.0)',
  32. ehcacheRange: '[1.4.1, 2.5.0)',
  33. openid4javaRange: '[0.9.5, 1.0.0)',
  34. springLdapRange: '[1.3.0,1.4.0)',
  35. apacheDSRange: '[1.5.5, 1.6)',
  36. apacheDSSharedRange: '[0.9.15, 1.0)',
  37. ldapSdkRange: '[4.1, 5.0)',
  38. aopAllianceRange: '[1.0.0, 2.0.0)'
  39. ]
  40. configurations {
  41. // Configuration which is ONLY used for compileJava and will not be inherited by any others
  42. // Revisit post Gradle 1.0
  43. compileOnly
  44. // Used to identify deps which should be marked as "provided" in maven poms
  45. provided
  46. testCompile.extendsFrom provided
  47. compile.transitive = false
  48. testCompile.transitive = false
  49. }
  50. // Integration test setup
  51. configurations {
  52. integrationTestCompile {
  53. extendsFrom testCompile
  54. }
  55. integrationTestRuntime {
  56. extendsFrom integrationTestCompile, testRuntime
  57. }
  58. }
  59. sourceSets {
  60. integrationTest {
  61. java.srcDir file('src/integration-test/java')
  62. resources.srcDir file('src/integration-test/resources')
  63. compileClasspath = sourceSets.main.output + sourceSets.test.output + configurations.integrationTestCompile
  64. runtimeClasspath = output + compileClasspath + configurations.integrationTestRuntime
  65. }
  66. }
  67. task integrationTest(type: Test, dependsOn: jar) {
  68. testClassesDir = sourceSets.integrationTest.output.classesDir
  69. logging.captureStandardOutput(LogLevel.INFO)
  70. classpath = sourceSets.integrationTest.runtimeClasspath
  71. maxParallelForks = 1
  72. testReport = false
  73. }
  74. dependencies {
  75. compileOnly 'commons-logging:commons-logging:1.1.1'
  76. compile ("org.springframework:spring-core:$springVersion") {
  77. exclude(group: 'commons-logging', module: 'commons-logging')
  78. }
  79. testCompile 'junit:junit:4.7',
  80. 'org.mockito:mockito-core:1.8.5',
  81. "org.springframework:spring-test:$springVersion",
  82. 'org.easytesting:fest-assert:1.4'
  83. // Use slf4j/logback for logging
  84. testRuntime "org.slf4j:jcl-over-slf4j:$slf4jVersion",
  85. "ch.qos.logback:logback-classic:$logbackVersion"
  86. }
  87. [configurations.runtime, configurations.default]*.exclude(module: 'commons-logging')
  88. sourceSets.main.compileClasspath += configurations.compileOnly
  89. sourceSets.main.compileClasspath += configurations.provided
  90. [compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
  91. test {
  92. jvmArgs = ['-ea', '-Xmx500m']
  93. maxParallelForks = guessMaxForks()
  94. logging.captureStandardOutput(LogLevel.INFO)
  95. testReport = false
  96. }
  97. def guessMaxForks() {
  98. int processors = Runtime.runtime.availableProcessors()
  99. return Math.max(2, (int) (processors / 2))
  100. }
  101. javadoc {
  102. title = "Spring Security $version API"
  103. source = sourceSets.main.allJava
  104. classpath += configurations.compileOnly + configurations.provided
  105. options {
  106. memberLevel = org.gradle.external.javadoc.JavadocMemberLevel.PROTECTED
  107. author = true
  108. header = project.name
  109. outputLevel = org.gradle.external.javadoc.JavadocOutputLevel.QUIET
  110. links = [
  111. "http://static.springframework.org/spring/docs/3.0.x/javadoc-api",
  112. "http://static.springsource.org/spring-ldap/docs/1.3.x/apidocs/",
  113. "http://download.oracle.com/javase/6/docs/api/"
  114. ]
  115. groups = [
  116. 'Spring Security Core':[
  117. 'org.springframework.security.core*',
  118. 'org.springframework.security.authentication*',
  119. 'org.springframework.security.access*',
  120. 'org.springframework.security.remoting*',
  121. 'org.springframework.security.provisioning*',
  122. 'org.springframework.security.util*'],
  123. 'Spring Security Web':['org.springframework.security.web*'],
  124. 'Spring Security LDAP':['org.springframework.security.ldap*'],
  125. 'Spring Security Crypto':['org.springframework.security.crypto*'],
  126. 'Spring Security OpenID':['org.springframework.security.openid*'],
  127. 'Spring Security CAS':['org.springframework.security.cas*'],
  128. 'Spring Security ACL':['org.springframework.security.acls*'],
  129. 'Spring Security Config':['org.springframework.security.config*'],
  130. 'Spring Security Taglibs':['org.springframework.security.taglibs*'],
  131. ]
  132. }
  133. }
  134. task javadocJar(type: Jar) {
  135. classifier = 'javadoc'
  136. from javadoc
  137. }