javaprojects.gradle 4.9 KB

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