javaprojects.gradle 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  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.1.0)",
  21. springRange: "[$springVersion, 3.1.0)",
  22. aspectjRange: '[1.6.0, 1.7.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. 'junit:junit-dep:4.10',
  74. 'org.mockito:mockito-core:1.9.5',
  75. 'org.jmock:jmock:2.6.0',
  76. 'org.jmock:jmock-junit4:2.6.0',
  77. 'org.hamcrest:hamcrest-core:1.1',
  78. 'org.hamcrest:hamcrest-library:1.1',
  79. "org.springframework:spring-test:$springVersion"
  80. // Use slf4j/logback for logging
  81. testRuntime "org.slf4j:jcl-over-slf4j:$slf4jVersion",
  82. "ch.qos.logback:logback-classic:$logbackVersion"
  83. }
  84. [configurations.runtime, configurations.default]*.exclude(module: 'commons-logging')
  85. sourceSets.main.compileClasspath += configurations.compileOnly
  86. sourceSets.main.compileClasspath += configurations.provided
  87. [compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
  88. test {
  89. jvmArgs = ['-ea', '-Xmx500m']
  90. maxParallelForks = guessMaxForks()
  91. logging.captureStandardOutput(LogLevel.INFO)
  92. testReport = false
  93. }
  94. def guessMaxForks() {
  95. int processors = Runtime.runtime.availableProcessors()
  96. return Math.max(2, (int) (processors / 2))
  97. }
  98. javadoc {
  99. title = "Spring Security $version API"
  100. source = sourceSets.main.allJava
  101. classpath += configurations.compileOnly + configurations.provided
  102. options {
  103. memberLevel = org.gradle.external.javadoc.JavadocMemberLevel.PROTECTED
  104. author = true
  105. header = project.name
  106. outputLevel = org.gradle.external.javadoc.JavadocOutputLevel.QUIET
  107. links = [
  108. "http://static.springframework.org/spring/docs/3.0.x/javadoc-api",
  109. "http://static.springsource.org/spring-ldap/docs/1.3.x/apidocs/",
  110. "http://download.oracle.com/javase/6/docs/api/"
  111. ]
  112. groups = [
  113. 'Spring Security Core':[
  114. 'org.springframework.security.core*',
  115. 'org.springframework.security.authentication*',
  116. 'org.springframework.security.access*',
  117. 'org.springframework.security.remoting*',
  118. 'org.springframework.security.provisioning*',
  119. 'org.springframework.security.util*'],
  120. 'Spring Security Web':['org.springframework.security.web*'],
  121. 'Spring Security LDAP':['org.springframework.security.ldap*'],
  122. 'Spring Security Crypto':['org.springframework.security.crypto*'],
  123. 'Spring Security OpenID':['org.springframework.security.openid*'],
  124. 'Spring Security CAS':['org.springframework.security.cas*'],
  125. 'Spring Security ACL':['org.springframework.security.acls*'],
  126. 'Spring Security Config':['org.springframework.security.config*'],
  127. 'Spring Security Taglibs':['org.springframework.security.taglibs*'],
  128. ]
  129. }
  130. }
  131. task javadocJar(type: Jar) {
  132. classifier = 'javadoc'
  133. from javadoc
  134. }