2010-03-28 18:54:41 -04:00
|
|
|
apply plugin: 'maven'
|
2010-03-03 10:40:57 -05:00
|
|
|
|
|
|
|
// Create a source jar for uploading
|
|
|
|
task sourceJar(type: Jar) {
|
|
|
|
classifier = 'sources'
|
|
|
|
from sourceSets.main.java
|
|
|
|
}
|
|
|
|
|
2010-08-02 22:01:53 -04:00
|
|
|
artifacts {
|
|
|
|
archives sourceJar
|
|
|
|
}
|
|
|
|
|
|
|
|
// Configuration for SpringSource s3 maven deployer
|
2010-03-03 10:40:57 -05:00
|
|
|
configurations {
|
|
|
|
deployerJars
|
|
|
|
}
|
2010-08-02 22:01:53 -04:00
|
|
|
dependencies {
|
|
|
|
deployerJars "org.springframework.build.aws:org.springframework.build.aws.maven:3.0.0.RELEASE"
|
2010-03-03 10:40:57 -05:00
|
|
|
}
|
|
|
|
|
2010-07-06 18:56:31 -04:00
|
|
|
// Remove the archive configuration from the runtime configuration, so that anything added to archives
|
|
|
|
// (such as the source jar) is no longer included in the runtime classpath
|
|
|
|
configurations.default.extendsFrom = [configurations.runtime] as Set
|
|
|
|
// Add the main jar into the default configuration
|
|
|
|
artifacts { 'default' jar }
|
|
|
|
|
2010-03-03 10:40:57 -05:00
|
|
|
gradle.taskGraph.whenReady {graph ->
|
|
|
|
if (graph.hasTask(uploadArchives)) {
|
|
|
|
// check properties defined and fail early
|
|
|
|
s3AccessKey
|
|
|
|
s3SecretAccessKey
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-03-07 16:58:25 -05:00
|
|
|
def deployer = null
|
|
|
|
|
2010-03-03 10:40:57 -05:00
|
|
|
uploadArchives {
|
2010-08-04 17:55:17 -04:00
|
|
|
def releaseRepositoryUrl = "file://${project.properties.mavenSyncRepoDir}"
|
|
|
|
def milestoneRepositoryUrl = 's3://maven.springframework.org/milestone'
|
|
|
|
def snapshotRepositoryUrl = 's3://maven.springframework.org/snapshot'
|
|
|
|
|
2010-03-07 16:58:25 -05:00
|
|
|
deployer = repositories.mavenDeployer {
|
2010-03-03 10:40:57 -05:00
|
|
|
configuration = configurations.deployerJars
|
|
|
|
if (releaseBuild) {
|
|
|
|
// "mavenSyncRepoDir" should be set in properties
|
2010-08-04 17:55:17 -04:00
|
|
|
repository(url: releaseRepositoryUrl)
|
2010-03-03 10:40:57 -05:00
|
|
|
} else {
|
2010-08-04 17:55:17 -04:00
|
|
|
s3credentials = [userName: project.properties.s3AccessKey, passphrase: project.properties.s3SecretAccessKey]
|
|
|
|
repository(url: milestoneRepositoryUrl) {
|
2010-03-03 10:40:57 -05:00
|
|
|
authentication(s3credentials)
|
|
|
|
}
|
2010-08-04 17:55:17 -04:00
|
|
|
snapshotRepository(url: snapshotRepositoryUrl) {
|
2010-03-03 10:40:57 -05:00
|
|
|
authentication(s3credentials)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-03-07 16:58:25 -05:00
|
|
|
// Pom Customization
|
|
|
|
|
|
|
|
installer = install.repositories.mavenInstaller
|
|
|
|
|
2010-08-19 17:41:51 -04:00
|
|
|
def optionalDeps = ['ehcache', 'log4j', 'apacheds-core', 'jsp-api', 'jsr250-api', 'ldapsdk']
|
|
|
|
def clogging = new org.apache.maven.model.Dependency()
|
|
|
|
clogging.artifactId = clogging.groupId = "commons-logging"
|
|
|
|
clogging.scope = 'compile'
|
|
|
|
clogging.optional = true
|
|
|
|
clogging.version = '1.1.1'
|
2010-03-07 16:58:25 -05:00
|
|
|
|
2010-03-07 18:53:33 -05:00
|
|
|
[installer, deployer]*.pom.collect { pom ->
|
2010-03-07 16:58:25 -05:00
|
|
|
pom.scopeMappings.addMapping(10, configurations.provided, 'provided')
|
2010-03-07 18:53:33 -05:00
|
|
|
}
|
2010-03-07 16:58:25 -05:00
|
|
|
|
2010-03-07 18:53:33 -05:00
|
|
|
[installer, deployer]*.pom*.whenConfigured { pom ->
|
2010-08-19 17:41:51 -04:00
|
|
|
// Remove test scope dependencies from published poms
|
|
|
|
pom.dependencies = pom.dependencies.findAll {it.scope != 'test'}
|
2010-03-07 16:58:25 -05:00
|
|
|
pom.dependencies.findAll { dep ->
|
|
|
|
optionalDeps.contains(dep.artifactId) ||
|
|
|
|
dep.groupId.startsWith('org.apache.directory') ||
|
|
|
|
dep.groupId.startsWith('org.slf4j')
|
|
|
|
}*.optional = true
|
|
|
|
|
2010-08-19 17:41:51 -04:00
|
|
|
pom.dependencies.add(clogging)
|
|
|
|
|
2010-03-07 16:58:25 -05:00
|
|
|
if (pom.artifactId == 'spring-security-config') {
|
|
|
|
pom.dependencies.find { dep -> dep.artifactId == 'spring-security-web'}.optional = true
|
|
|
|
pom.dependencies.find { dep -> dep.artifactId == 'spring-web'}.optional = true
|
|
|
|
}
|
|
|
|
}
|