javaprojects.gradle 5.3 KB

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