Uploading signed tar.gz to OSSRH nexus breaks due to incorrect file extension renaming


(Roger Leigh) #1

From root
and sub-project:

tasks.withType(Tar){
    compression = Compression.GZIP
    extension = 'tar.gz'
}

After running ./gradlew uploadArchives, I see this in nexus:

Note that the tar.gz extension of one artifact is replaced by .gz.asc for the signature. This breaks nexus (I can’t close the repository).

Note in the local repository:

% ls -1 docs/sphinx/build/distributions  
ome-model-doc-5.7.1.tar.gz
ome-model-doc-5.7.1.tar.gz.asc
ome-model-doc-5.7.1.zip
ome-model-doc-5.7.1.zip.asc

Locally, the file names are all correct.

Has anyone encountered this before? Is it a problem with gradle or nexus (or both), and is there any workaround?

Note that it was working just fine with maven (see artifact).

Thanks all,
Roger


(Stefan Oehme) #2

Can you try the maven-publish plugin to see if it handles this better? If it fails too, please open an issue on Github with a small example project.


(Roger Leigh) #3

Hi,

The project is already using maven-publish (root project).

Which github repository should I open the issue against?

Thanks,
Roger


(Stefan Oehme) #4

uploadArchives is not part of the maven-publish plugin. That’s the old upload infrastructure. You’re not actually using maven-publish. Please have a look at the documentation


(Roger Leigh) #5

Thanks for the suggestion, I’ll give it a go.

I’ve converted the repository to use maven-publish here on the gradle-maven-publish branch. The root build.gradle and docs build.gradle seem mostly OK, but I have a couple of questions:

  1. gradle assemble is signing the artifacts, but the poms are not signed, and no signatures are uploaded either for artifacts or poms. I’ve followed the instructions, but is something obviously missing? gradle publish uploads everything except the signatures, so it’s mostly working, but missing an essential part.

  2. The root pom defines default pom metadata with mavenJava(MavenPublication). However, the docs use docs(MavenPublication) in the publishing block while the Java components all use mavenJava(MavenPublication). Seems to work, but I’m not sure it’s strictly correct. Is there any way to define the common pom as being suitable for all publication types, to avoid duplication?

Thanks again,
Roger


(Stefan Oehme) #6

You’re signing the wrong thing, see the doc page I linked above for how to sign a publication. Also make sure to remove the old maven plugin to avoid confusion.

If you don’t want the same publication for docs, exclude it in the subprojects block, otherwise Gradle will try to publish both. For simplicity I’d just use the mavenJava publication there and not bother having a differently named one in the docs project.


(Roger Leigh) #7

Ah, yes. Thanks, with that tweak it all works correctly and I’ve been able to stage and release to maven central.

Thanks again,
Roger