I have a project using the application and maven-publish plugins. I want to include the results of the distTar and distZip tasks as archives that get uploaded to the Maven repository.
I’ve tried adding separate publications for the zip and tar archives, but these end up generating a pom which overwrites the main java pom.
publishing {
publications {
mavenDefault(MavenPublication) {
from components.java
artifact(sourceJar) {
classifier "sources"
}
}
zip(MavenPublication) {
artifact distZip
}
tar(MavenPublication) {
artifact distTar
}
}
repositories {
...
}
}
I tried to disable the Pom File generation tasks that get created for each MavenPublication, but this doesn’t seem to be allowed.
model {
tasks.generatePomFileForTarPublication.enabled=false
tasks.generatePomFileForZipPublication.enabled=false
}
A problem occurred evaluating root project '...'.
> No such property: enabled for class: org.gradle.model.dsl.internal.NonTransformedModelDslBacking
It appears that I can add the distZip and distTar artifacts to the mavenDefault publication, but only if I give them unique classifiers, in which case I end up with unwanted classifiers in the file names (e.g. foo-1.0.0-zip.zip).
Is there any way to prevent the other publications from generating a pom, or to not add the classifier into the filename of the published artifact if using the same publication?
Thanks, Andrew