spring-security/gradle/javaprojects.gradle

220 lines
8.1 KiB
Groovy
Raw Normal View History

import org.gradle.plugins.ide.eclipse.model.SourceFolder
2010-03-28 18:54:41 -04:00
apply plugin: 'java'
apply plugin: 'groovy'
2013-09-11 18:30:50 -04:00
apply plugin: 'javadocHotfix'
apply plugin: 'eclipse-wtp'
2013-07-16 16:15:42 -04:00
apply plugin: 'propdeps'
apply plugin: 'propdeps-maven'
apply plugin: 'propdeps-idea'
apply plugin: 'propdeps-eclipse'
sourceCompatibility = 1.5
targetCompatibility = 1.5
ext.ehcacheVersion = '2.6.5'
2012-06-29 13:59:22 -04:00
ext.aspectjVersion = '1.6.10'
ext.apacheDsVersion = '1.5.5'
2014-04-11 10:57:18 -04:00
ext.jstlVersion = '1.2.1'
2012-06-29 13:59:22 -04:00
ext.jettyVersion = '6.1.26'
2013-12-13 20:21:10 -05:00
ext.hsqlVersion = '2.3.1'
ext.slf4jVersion = '1.7.5'
2012-06-29 13:59:22 -04:00
ext.logbackVersion = '0.9.29'
ext.cglibVersion = '2.2'
ext.powerMockVersion = '1.5.1'
SEC-2542: Use exclusions to remove duplicate dependencies A number of projects had duplicate dependencies on their classpaths as a result of the same classes being available in more than one artifact, each with different Maven coordinates. Typically this only affected the tests, but meant that the actual classes that were loaded was somewhat unpredictable and had the potential to vary between an IDE and the command line depending on the order in which the aritfacts appeared on the classpath. This commit adds a number of exclusions to remove such duplicates. In addition to the new exclusions, notable other changes are: - Spring Data JPA has been updated to 1.4.1. This brings its transitive dependency upon spring-data-commons into line with Spring LDAP's and prevents both spring-data-commons-core and spring-data-commons from being on the classpath - All Servlet API dependencies have been updated to use the official artifact with all transitive dependencies on unofficial servlet API artifacts being excluded. - In places, groovy has been replaced with groovy-all. This removes some duplicates caused by groovy's transitive dependencies. - JUnit has been updated to 4.11 which brings its transitive Hamcrest dependency into line with other components. There appears to be a bug in Gradle which means that some exclusions applied to an artifact do not work reliably. To work around this problem it has been necessary to apply some exclusions at the configuration level Conflicts: samples/messages-jc/pom.xml
2014-04-02 09:48:55 -04:00
ext.servletApiVersion = '3.0.1'
ext.seleniumVersion = '2.33.0'
ext.groovyVersion = '2.0.5'
ext.spockVersion = '0.7-groovy-2.0'
ext.gebVersion = '0.9.0'
ext.thymeleafVersion = '2.1.2.RELEASE'
ext.spockDependencies = [
dependencies.create("org.spockframework:spock-spring:$spockVersion") {
exclude group: 'junit', module: 'junit-dep'
},
dependencies.create("org.spockframework:spock-core:$spockVersion") {
exclude group: 'junit', module: 'junit-dep'
}
]
ext.powerMockDependencies = [
"org.powermock:powermock-core:$powerMockVersion",
"org.powermock:powermock-api-support:$powerMockVersion",
"org.powermock:powermock-module-junit4-common:$powerMockVersion",
"org.powermock:powermock-module-junit4:$powerMockVersion",
dependencies.create("org.powermock:powermock-api-mockito:$powerMockVersion") {
exclude group: 'org.mockito', module: 'mockito-all'
},
"org.powermock:powermock-reflect:$powerMockVersion"
]
2014-06-12 13:01:04 -04:00
ext.jstlDependencies = [
"javax.servlet.jsp.jstl:javax.servlet.jsp.jstl-api:$jstlVersion",
"org.apache.taglibs:taglibs-standard-jstlel:1.2.1"
]
ext.apachedsDependencies = [
"org.apache.directory.server:apacheds-core:$apacheDsVersion",
"org.apache.directory.server:apacheds-core-entry:$apacheDsVersion",
"org.apache.directory.server:apacheds-protocol-shared:$apacheDsVersion",
"org.apache.directory.server:apacheds-protocol-ldap:$apacheDsVersion",
"org.apache.directory.server:apacheds-server-jndi:$apacheDsVersion",
'org.apache.directory.shared:shared-ldap:0.9.15'
]
// Integration test setup
configurations {
integrationTestCompile {
extendsFrom testCompile, optional, provided
}
integrationTestRuntime {
extendsFrom integrationTestCompile, testRuntime
}
}
sourceSets {
integrationTest {
java.srcDir file('src/integration-test/java')
groovy.srcDirs file('src/integration-test/groovy')
resources.srcDir file('src/integration-test/resources')
2012-06-29 13:59:22 -04:00
compileClasspath = sourceSets.main.output + sourceSets.test.output + configurations.integrationTestCompile
runtimeClasspath = output + compileClasspath + configurations.integrationTestRuntime
}
}
task integrationTest(type: Test, dependsOn: jar) {
2012-06-29 13:59:22 -04:00
testClassesDir = sourceSets.integrationTest.output.classesDir
logging.captureStandardOutput(LogLevel.INFO)
classpath = sourceSets.integrationTest.runtimeClasspath
maxParallelForks = 1
reports {
html.destination = project.file("$project.buildDir/reports/integration-tests/")
junitXml.destination = project.file("$project.buildDir/integration-test-results/")
}
}
2013-07-15 23:13:15 -04:00
project.conf2ScopeMappings.addMapping(MavenPlugin.TEST_COMPILE_PRIORITY + 1, project.configurations.getByName("integrationTestCompile"), Conf2ScopeMappingContainer.TEST)
project.conf2ScopeMappings.addMapping(MavenPlugin.TEST_COMPILE_PRIORITY + 2, project.configurations.getByName("integrationTestRuntime"), Conf2ScopeMappingContainer.TEST)
check.dependsOn integrationTest
2013-07-15 23:13:15 -04:00
dependencies {
2013-07-16 16:15:42 -04:00
optional 'commons-logging:commons-logging:1.1.1'
compile ("org.springframework:spring-core:$springVersion") {
exclude(group: 'commons-logging', module: 'commons-logging')
}
SEC-2542: Use exclusions to remove duplicate dependencies A number of projects had duplicate dependencies on their classpaths as a result of the same classes being available in more than one artifact, each with different Maven coordinates. Typically this only affected the tests, but meant that the actual classes that were loaded was somewhat unpredictable and had the potential to vary between an IDE and the command line depending on the order in which the aritfacts appeared on the classpath. This commit adds a number of exclusions to remove such duplicates. In addition to the new exclusions, notable other changes are: - Spring Data JPA has been updated to 1.4.1. This brings its transitive dependency upon spring-data-commons into line with Spring LDAP's and prevents both spring-data-commons-core and spring-data-commons from being on the classpath - All Servlet API dependencies have been updated to use the official artifact with all transitive dependencies on unofficial servlet API artifacts being excluded. - In places, groovy has been replaced with groovy-all. This removes some duplicates caused by groovy's transitive dependencies. - JUnit has been updated to 4.11 which brings its transitive Hamcrest dependency into line with other components. There appears to be a bug in Gradle which means that some exclusions applied to an artifact do not work reliably. To work around this problem it has been necessary to apply some exclusions at the configuration level Conflicts: samples/messages-jc/pom.xml
2014-04-02 09:48:55 -04:00
testCompile 'junit:junit:4.11',
'org.mockito:mockito-core:1.9.5',
"org.springframework:spring-test:$springVersion",
'org.easytesting:fest-assert:1.4'
// Use slf4j/logback for logging
testRuntime "org.slf4j:jcl-over-slf4j:$slf4jVersion",
"ch.qos.logback:logback-classic:$logbackVersion"
}
SEC-2542: Use exclusions to remove duplicate dependencies A number of projects had duplicate dependencies on their classpaths as a result of the same classes being available in more than one artifact, each with different Maven coordinates. Typically this only affected the tests, but meant that the actual classes that were loaded was somewhat unpredictable and had the potential to vary between an IDE and the command line depending on the order in which the aritfacts appeared on the classpath. This commit adds a number of exclusions to remove such duplicates. In addition to the new exclusions, notable other changes are: - Spring Data JPA has been updated to 1.4.1. This brings its transitive dependency upon spring-data-commons into line with Spring LDAP's and prevents both spring-data-commons-core and spring-data-commons from being on the classpath - All Servlet API dependencies have been updated to use the official artifact with all transitive dependencies on unofficial servlet API artifacts being excluded. - In places, groovy has been replaced with groovy-all. This removes some duplicates caused by groovy's transitive dependencies. - JUnit has been updated to 4.11 which brings its transitive Hamcrest dependency into line with other components. There appears to be a bug in Gradle which means that some exclusions applied to an artifact do not work reliably. To work around this problem it has been necessary to apply some exclusions at the configuration level Conflicts: samples/messages-jc/pom.xml
2014-04-02 09:48:55 -04:00
[configurations.runtime, configurations.default, configurations.testCompile]*.exclude(module: 'commons-logging')
2013-09-18 17:13:03 -04:00
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
if (details.requested.group == 'org.slf4j') {
details.useVersion slf4jVersion
}
}
2013-09-18 17:13:03 -04:00
}
2010-08-16 21:16:12 -04:00
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
2014-04-11 10:57:18 -04:00
project.tasks.matching { it instanceof Test && it.name != 'integrationTest' }.all {
jvmArgs = ['-ea', '-Xmx500m', '-XX:MaxPermSize=256M']
maxParallelForks = guessMaxForks()
logging.captureStandardOutput(LogLevel.INFO)
}
def guessMaxForks() {
int processors = Runtime.runtime.availableProcessors()
return Math.max(2, (int) (processors / 2))
}
javadoc {
title = "Spring Security $version API"
source = sourceSets.main.allJava
options {
memberLevel = org.gradle.external.javadoc.JavadocMemberLevel.PROTECTED
author = true
header = project.name
outputLevel = org.gradle.external.javadoc.JavadocOutputLevel.QUIET
links = [
"http://static.springsource.org/spring/docs/3.2.x/javadoc-api/",
"http://static.springsource.org/spring-ldap/docs/1.3.x/apidocs/",
"http://download.oracle.com/javase/6/docs/api/"
]
groups = [
'Spring Security Core':[
'org.springframework.security.core*',
'org.springframework.security.authentication*',
'org.springframework.security.access*',
'org.springframework.security.remoting*',
'org.springframework.security.provisioning*',
'org.springframework.security.util*'],
'Spring Security Web':['org.springframework.security.web*'],
'Spring Security LDAP':['org.springframework.security.ldap*'],
'Spring Security Crypto':['org.springframework.security.crypto*'],
'Spring Security OpenID':['org.springframework.security.openid*'],
'Spring Security CAS':['org.springframework.security.cas*'],
'Spring Security ACL':['org.springframework.security.acls*'],
'Spring Security Config':['org.springframework.security.config*'],
'Spring Security Taglibs':['org.springframework.security.taglibs*'],
]
}
}
eclipse.classpath.downloadSources = true
// http://forums.gradle.org/gradle/topics/eclipse_wtp_deploys_testcode_to_server_example_provided
eclipse.classpath {
defaultOutputDir = file('bin/main')
file.whenMerged { cp ->
cp.entries.findAll { it instanceof SourceFolder && (it.path.contains("test") || it.path.contains("Test")) }*.output = "bin/test"
}
}
// GRADLE-1116
project.eclipse.classpath.file.whenMerged { classpath ->
classpath.entries.removeAll { entry -> entry.path.endsWith('/build/resources/test') }
classpath.entries.removeAll { entry -> entry.path.endsWith('/build/classes/test') }
classpath.entries.removeAll { entry -> entry.path.endsWith('/build/resources/main') }
classpath.entries.removeAll { entry -> entry.path.endsWith('/build/classes/main') }
}
// GRADLE-1422
project.eclipseClasspath.doFirst {
// delay adding whenMerged till the entryAttributes are added (must be the last whenMerged)
project.eclipse.classpath.file.whenMerged { classpath ->
def includeDeps = project.configurations.getByName('runtime').collect {f -> f.absolutePath } as Set
classpath.entries.each { cp ->
if(cp instanceof org.gradle.plugins.ide.eclipse.model.Library) {
def include = includeDeps.contains(cp.path)
def attr = 'org.eclipse.jst.component.dependency'
if(!include) {
cp.entryAttributes.remove(attr)
}
}
}
}
}
project.idea.module {
scopes.TEST.plus += [project.configurations.integrationTestRuntime]
}
task javadocJar(type: Jar) {
classifier = 'javadoc'
from javadoc
}
2013-12-09 16:51:49 -05:00
artifacts {
archives javadocJar
}