12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- apply plugin: 'maven'
- // Create a source jar for uploading
- task sourceJar(type: Jar) {
- classifier = 'sources'
- from sourceSets.main.java
- }
- artifacts {
- archives sourceJar
- }
- // Configuration for SpringSource s3 maven deployer
- configurations {
- deployerJars
- }
- dependencies {
- deployerJars "org.springframework.build.aws:org.springframework.build.aws.maven:3.0.0.RELEASE"
- }
- // 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 }
- gradle.taskGraph.whenReady {graph ->
- if (graph.hasTask(uploadArchives)) {
- // check properties defined and fail early
- s3AccessKey
- s3SecretAccessKey
- }
- }
- def deployer = null
- uploadArchives {
- def releaseRepositoryUrl = "file://${project.properties.mavenSyncRepoDir}"
- def milestoneRepositoryUrl = 's3://maven.springframework.org/milestone'
- def snapshotRepositoryUrl = 's3://maven.springframework.org/snapshot'
- deployer = repositories.mavenDeployer {
- configuration = configurations.deployerJars
- if (releaseBuild) {
- // "mavenSyncRepoDir" should be set in properties
- repository(url: releaseRepositoryUrl)
- } else {
- s3credentials = [userName: project.properties.s3AccessKey, passphrase: project.properties.s3SecretAccessKey]
- repository(url: milestoneRepositoryUrl) {
- authentication(s3credentials)
- }
- snapshotRepository(url: snapshotRepositoryUrl) {
- authentication(s3credentials)
- }
- }
- }
- }
- // Pom Customization
- installer = install.repositories.mavenInstaller
- def optionalDeps = ['ehcache', 'log4j', 'apacheds-core', 'jsp-api', 'jsr250-api', 'ldapsdk']
- // Workaround for GRADLE-1497
- def cloggingDep(Class cl) {
- clogging = cl.newInstance()
- clogging.artifactId = clogging.groupId = "commons-logging"
- clogging.scope = 'compile'
- clogging.optional = true
- clogging.version = '1.1.1'
- clogging
- }
- [installer, deployer]*.pom.collect { pom ->
- pom.scopeMappings.addMapping(10, configurations.provided, 'provided')
- }
- [installer, deployer]*.pom*.whenConfigured { pom ->
- // Remove test scope dependencies from published poms
- pom.dependencies = pom.dependencies.findAll {it.scope != 'test'}
- pom.dependencies.findAll { dep ->
- optionalDeps.contains(dep.artifactId) ||
- dep.groupId.startsWith('org.apache.directory') ||
- dep.groupId.startsWith('org.slf4j')
- }*.optional = true
- pom.dependencies.add(cloggingDep(pom.dependencies[0].class))
- 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
- }
- }
|