Publishing a second artifact replaced the first one, or so it seems


(Richard Johnson) #1

this issue is driving me mad, I am sure it’s something Iam doing wrong but can’t see what. http://stackoverflow.com/questions/15879900/publish-artifact-overwrite-other-artifact-in-gradle


#2

How would you like the 2 jars to be published? ie: what do you want the published repository to end up looking like?

Your repository patterns look a bit ‘unusual’ to me, but there might be a way to include the 2 jar files into a single publication. But it’s not clear to me what you’re trying to achieve.


(Richard Johnson) #3

I’ve identified the issue and it looks like a Gradle bug. I’ve update the stack overflow with further details.

Essentially it comes down to there being multiple artifacts that when the appendix and classifier aren’t used the names are the same so the unique identifier is no longer unique and the same file is therefore published to all of the publishing locations.

The deployment structure is really quite simple: module/core/1/jar/core-1.jar module/notcore/1/jar/notcore-1.jar e.t.c.

The patterns can look unusual… they’re not the source of the problem.

Hopefully these details will enable you to identify the missing bits of the publishing side of things and you can get it out of incubation :slight_smile:


#4

The problem is not with the publishing support: it’s due to the fact that Gradle is creating both of your jars with the exact same name. You can see this by executing ‘gradle bigJar’ and ‘gradle smallJar’: both jars are created as 'build/libs/[group]-[version].jar.

You need to add something to the ‘Jar’ tasks to differentiate their output files. The most common attribute to use is ‘basename’, but there are a number of options as outline in the DSL reference.


(Richard Johnson) #5

thanks for repeating what I put on stack overflow, as I point out I use appendix to change the name but also could have used classifier.