Hi, I’m a completely newbie to Gradle and I’m trying to upload both War, Jar & Sources to artifactory. War & sources are OK with the following build.gradle:
apply plugin: 'war'
task packageSources(type: Jar) {
classifier = 'sources'
from sourceSets.main.allSource
}
task packageWarApp(type: War) {
}
artifacts.archives packageSources
artifacts.archives packageWarApp
apply plugin: 'artifactory'
artifactory {
publish {
contextUrl = "https://myrepo/artifactory"
repository {
repoKey = 'libs-local'
username = 'user'
password = 'pass'
maven = true
}
}
}
The problem arises when I add the following:
task packageJarApp(type: Jar) {
}
artifacts.archives packageJarApp
gradlew artifactoryPublish fails with:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':install'.
> Could not publish configuration 'archives'
> A POM can not have multiple main artifacts. Already have MavenArtifact myapp:war:war:null, trying to add MavenArtifact myapp:jar:jar:null