75 lines
2.4 KiB
Groovy
75 lines
2.4 KiB
Groovy
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 {
|
|
description = "Maven deploy of archives artifacts to SpringSource Maven repos" // url appended below
|
|
// Maven deployment
|
|
def releaseRepositoryUrl = "file://${project.properties.mavenSyncRepoDir}"
|
|
def milestoneRepositoryUrl = 's3://maven.springframework.org/milestone'
|
|
def snapshotRepositoryUrl = 's3://maven.springframework.org/snapshot'
|
|
|
|
// add a configuration with a classpath that includes our s3 maven deployer
|
|
configurations { deployerJars }
|
|
dependencies {
|
|
deployerJars "org.springframework.build.aws:org.springframework.build.aws.maven:3.0.0.RELEASE"
|
|
}
|
|
|
|
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)
|
|
}
|
|
}
|
|
}
|
|
|
|
deployer.pom.project {
|
|
licenses {
|
|
license {
|
|
name "The Apache Software License, Version 2.0"
|
|
url "http://www.apache.org/licenses/LICENSE-2.0.txt"
|
|
distribution "repo"
|
|
}
|
|
}
|
|
}
|
|
} |