javaprojects.gradle 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  1. apply plugin: 'java'
  2. apply plugin: 'groovy'
  3. apply plugin: 'javadocHotfix'
  4. apply plugin: 'propdeps'
  5. apply plugin: 'propdeps-maven'
  6. sourceCompatibility = 1.6
  7. targetCompatibility = 1.6
  8. ext.apacheDsVersion = '1.5.5'
  9. ext.aspectjVersion = '1.8.14'
  10. ext.casClientVersion = '3.4.1'
  11. ext.cglibVersion = '3.2.12'
  12. ext.commonsCodecVersion = '1.12'
  13. ext.commonsCollectionsVersion = '3.2.2'
  14. ext.commonsLoggingVersion = '1.2'
  15. ext.ehcacheVersion = '2.10.6'
  16. ext.gebVersion = '0.10.0'
  17. ext.groovyVersion = '2.4.19'
  18. ext.hsqlVersion = '2.3.6'
  19. ext.hibernateVersion = '5.0.12.Final'
  20. ext.hibernateValidatorVersion = '5.3.6.Final'
  21. ext.jacksonDatabindVersion = '2.8.11.6'
  22. ext.javaPersistenceVersion = '2.1.1'
  23. ext.jettyVersion = '6.1.26'
  24. ext.jstlVersion = '1.2.2'
  25. ext.junitVersion = '4.12'
  26. ext.logbackVersion = '1.1.11'
  27. ext.powerMockVersion = '1.6.5'
  28. ext.seleniumVersion = '2.44.0'
  29. ext.servletApiVersion = '3.1.0'
  30. ext.slf4jVersion = '1.7.25'
  31. ext.spockVersion = '0.7-groovy-2.0'
  32. ext.springDataCommonsVersion = '1.13.23.RELEASE'
  33. ext.springDataJpaVersion = '1.11.23.RELEASE'
  34. ext.springDataRedisVersion = '1.8.23.RELEASE'
  35. ext.springSessionVersion = '1.3.5.RELEASE'
  36. ext.springBootVersion = '1.5.22.RELEASE'
  37. ext.thymeleafVersion = '3.0.11.RELEASE'
  38. ext.jsonassertVersion = '1.4.0'
  39. ext.validationApiVersion = '1.1.0.Final'
  40. ext.spockDependencies = [
  41. dependencies.create("org.spockframework:spock-spring:$spockVersion") {
  42. exclude group: 'junit', module: 'junit-dep'
  43. },
  44. dependencies.create("org.spockframework:spock-core:$spockVersion") {
  45. exclude group: 'junit', module: 'junit-dep'
  46. }
  47. ]
  48. ext.gebDependencies = spockDependencies + [
  49. "org.seleniumhq.selenium:selenium-htmlunit-driver:$seleniumVersion",
  50. "org.gebish:geb-spock:$gebVersion",
  51. 'commons-httpclient:commons-httpclient:3.1',
  52. "org.codehaus.groovy:groovy:$groovyVersion",
  53. "org.codehaus.groovy:groovy-all:$groovyVersion"
  54. ]
  55. ext.powerMockDependencies = [
  56. "org.powermock:powermock-core:$powerMockVersion",
  57. "org.powermock:powermock-api-support:$powerMockVersion",
  58. "org.powermock:powermock-module-junit4-common:$powerMockVersion",
  59. "org.powermock:powermock-module-junit4:$powerMockVersion",
  60. dependencies.create("org.powermock:powermock-api-mockito:$powerMockVersion") {
  61. exclude group: 'org.mockito', module: 'mockito-all'
  62. },
  63. "org.powermock:powermock-reflect:$powerMockVersion"
  64. ]
  65. ext.springCoreDependency = [
  66. dependencies.create("org.springframework:spring-core:$springVersion") {
  67. exclude(group: 'commons-logging', module: 'commons-logging')
  68. }
  69. ]
  70. ext.jstlDependencies = [
  71. "javax.servlet.jsp.jstl:javax.servlet.jsp.jstl-api:$jstlVersion",
  72. "org.apache.taglibs:taglibs-standard-jstlel:1.2.5"
  73. ]
  74. ext.apachedsDependencies = [
  75. "org.apache.directory.server:apacheds-core:$apacheDsVersion",
  76. "org.apache.directory.server:apacheds-core-entry:$apacheDsVersion",
  77. "org.apache.directory.server:apacheds-protocol-shared:$apacheDsVersion",
  78. "org.apache.directory.server:apacheds-protocol-ldap:$apacheDsVersion",
  79. "org.apache.directory.server:apacheds-server-jndi:$apacheDsVersion",
  80. 'org.apache.directory.shared:shared-ldap:0.9.15'
  81. ]
  82. // Integration test setup
  83. configurations {
  84. integrationTestCompile {
  85. extendsFrom testCompile, optional, provided
  86. }
  87. integrationTestRuntime {
  88. extendsFrom integrationTestCompile, testRuntime
  89. }
  90. springSnapshotTestRuntime.extendsFrom testRuntime
  91. }
  92. configurations.springSnapshotTestRuntime {
  93. resolutionStrategy.eachDependency { DependencyResolveDetails details ->
  94. if (details.requested.group == 'org.springframework') {
  95. details.useVersion 'latest.integration'
  96. }
  97. }
  98. }
  99. sourceSets {
  100. integrationTest {
  101. java.srcDir file('src/integration-test/java')
  102. groovy.srcDirs file('src/integration-test/groovy')
  103. resources.srcDir file('src/integration-test/resources')
  104. compileClasspath = sourceSets.main.output + sourceSets.test.output + configurations.integrationTestCompile
  105. runtimeClasspath = output + compileClasspath + configurations.integrationTestRuntime
  106. }
  107. }
  108. task integrationTest(type: Test, dependsOn: jar) {
  109. testClassesDir = sourceSets.integrationTest.output.classesDir
  110. logging.captureStandardOutput(LogLevel.INFO)
  111. classpath = sourceSets.integrationTest.runtimeClasspath
  112. maxParallelForks = 1
  113. reports {
  114. html.destination = project.file("$project.buildDir/reports/integration-tests/")
  115. junitXml.destination = project.file("$project.buildDir/integration-test-results/")
  116. }
  117. }
  118. project.conf2ScopeMappings.addMapping(MavenPlugin.TEST_COMPILE_PRIORITY + 1, project.configurations.getByName("integrationTestCompile"), Conf2ScopeMappingContainer.TEST)
  119. project.conf2ScopeMappings.addMapping(MavenPlugin.TEST_COMPILE_PRIORITY + 2, project.configurations.getByName("integrationTestRuntime"), Conf2ScopeMappingContainer.TEST)
  120. check.dependsOn integrationTest
  121. task springSnapshotTest(type: Test) {
  122. jvmArgs = ['-ea', '-Xmx500m', '-XX:MaxPermSize=128M']
  123. classpath = sourceSets.test.output + sourceSets.main.output + configurations.springSnapshotTestRuntime
  124. reports {
  125. html.destination = project.file("$buildDir/spring-snapshot-test-results/")
  126. junitXml.destination = project.file("$buildDir/reports/spring-snapshot-tests/")
  127. }
  128. }
  129. dependencies {
  130. optional "commons-logging:commons-logging:$commonsLoggingVersion"
  131. testCompile "junit:junit:$junitVersion",
  132. 'org.mockito:mockito-core:1.10.19',
  133. "org.springframework:spring-test:$springVersion",
  134. 'org.assertj:assertj-core:2.2.0'
  135. // Use slf4j/logback for logging
  136. testRuntime "org.slf4j:jcl-over-slf4j:$slf4jVersion",
  137. "ch.qos.logback:logback-classic:$logbackVersion"
  138. }
  139. [configurations.runtime, configurations.default, configurations.testCompile]*.exclude(module: 'commons-logging')
  140. configurations.all {
  141. resolutionStrategy.eachDependency { DependencyResolveDetails details ->
  142. if (details.requested.group == 'org.slf4j') {
  143. details.useVersion slf4jVersion
  144. }
  145. }
  146. }
  147. [compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
  148. project.tasks.matching { it instanceof Test && it.name != 'integrationTest' }.all {
  149. jvmArgs = ['-ea', '-Xmx500m', '-XX:MaxPermSize=512m']
  150. maxParallelForks = guessMaxForks()
  151. logging.captureStandardOutput(LogLevel.INFO)
  152. }
  153. def guessMaxForks() {
  154. int processors = Runtime.runtime.availableProcessors()
  155. return Math.max(2, (int) (processors / 2))
  156. }
  157. jar {
  158. manifest.attributes["Created-By"] = 'Spring Security Team'
  159. manifest.attributes["Implementation-Title"] = project.name
  160. manifest.attributes["Implementation-Version"] = project.version
  161. manifest.attributes["Premain-Class"] =
  162. manifest.attributes["Agent-Class"] =
  163. manifest.attributes["Can-Redefine-Classes"] = "true"
  164. manifest.attributes["Can-Retransform-Classes"] = "true"
  165. manifest.attributes["Can-Set-Native-Method-Prefix"] = "false"
  166. }
  167. javadoc {
  168. title = "Spring Security $version API"
  169. source = sourceSets.main.allJava
  170. logging.captureStandardError LogLevel.INFO
  171. logging.captureStandardOutput LogLevel.INFO
  172. options {
  173. memberLevel = org.gradle.external.javadoc.JavadocMemberLevel.PROTECTED
  174. author = true
  175. header = project.name
  176. outputLevel = org.gradle.external.javadoc.JavadocOutputLevel.QUIET
  177. links = [
  178. "https://docs.spring.io/spring/docs/3.2.x/javadoc-api/",
  179. "https://docs.spring.io/spring-ldap/docs/1.3.x/apidocs/",
  180. "https://download.oracle.com/javase/6/docs/api/"
  181. ]
  182. groups = [
  183. 'Spring Security Core':[
  184. 'org.springframework.security.core*',
  185. 'org.springframework.security.authentication*',
  186. 'org.springframework.security.access*',
  187. 'org.springframework.security.remoting*',
  188. 'org.springframework.security.provisioning*',
  189. 'org.springframework.security.util*'],
  190. 'Spring Security Web':['org.springframework.security.web*'],
  191. 'Spring Security LDAP':['org.springframework.security.ldap*'],
  192. 'Spring Security Crypto':['org.springframework.security.crypto*'],
  193. 'Spring Security OpenID':['org.springframework.security.openid*'],
  194. 'Spring Security CAS':['org.springframework.security.cas*'],
  195. 'Spring Security ACL':['org.springframework.security.acls*'],
  196. 'Spring Security Config':['org.springframework.security.config*'],
  197. 'Spring Security Taglibs':['org.springframework.security.taglibs*'],
  198. 'Spring Security Test':['org.springframework.security.test*'],
  199. ]
  200. addStringOption('-quiet')
  201. }
  202. }
  203. if (JavaVersion.current().isJava8Compatible()) {
  204. tasks.withType(Javadoc) {
  205. // Turn off doclint in JDK 8 Javadoc (too strict on checks)
  206. options.addStringOption('Xdoclint:none', '-quiet')
  207. }
  208. }
  209. task javadocJar(type: Jar) {
  210. classifier = 'javadoc'
  211. from javadoc
  212. }
  213. artifacts {
  214. archives javadocJar
  215. }