2
0

javaprojects.gradle 8.1 KB

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