How to publish different build artifacts from the same subproject?

(Carlo Luib-Finetti) #1

I have some kind of special subproject in a multi project. It has to produce two different jars from the same source code; one of the jars is a fat jar containing a lib directory housing third party libraries; the other must not contain this lib directory. The subproject defines the jar clause and a special task which produces a special jar. Now I do want to upload both of them onto Artifactory using Maven Publishing.

Oh yes, I read the manual, ch. “36.2.5. Publishing multiple modules”. And tried the given sample. But, my publishing definitions have their home in a subprojects clause in the root project of a multi project. Therefore I cannot do a specialised definition in a subproject; it leads to an errorr whilst compiling.

I tried calling the special task from within the root skript; which works building the jar. But it does not upload this artifact onto the repository.

mavenPublish_ method setArtifacts not working as expected