I want to upload my artifacts to a remote Nexus repo. Therefore I have configured a snaphot and a release repo in Nexus. Deployment to both works.
Now I want to configure my build so I can decide in which repo I want to deploy:
gradle uploadArchives
should deploy to my snapshots repogradle release uploadArchives
should deploy to my release repo
This was my try:
apply plugin: 'war'
apply plugin: 'maven'
group = 'testgroup'
version = '2.0.0'
def release = false
repositories {
mavenCentral()
mavenLocal()
}
dependencies{ providedCompile 'javax:javaee-api:6.0' }
task release <<{
release = true;
println 'releasing!'
}
uploadArchives {
repositories {
mavenDeployer {
repository(url: "http://.../nexus/content/repositories/releases"){
authentication(userName: "admin", password: "admin123")
}
addFilter('lala'){ x, y -> release }
}
mavenDeployer {
repository(url: "http://.../nexus/content/repositories/snapshots"){
authentication(userName: "admin", password: "admin123")
}
addFilter('lala'){ x, y ->!release}
pom.version = version + '-SNAPSHOT'
}
}
}
The build works if I comment out one of the two mavenDeployer configs, but not as a whole.
Any ideas how to configure two target archives in one build file?