javaprojects.gradle 5.1 KB

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