I have a situation where I have a single project, that will publish more than one artifact. I’m able to control this with multiple publications and tweaking the artifact and classifier each time. For example, my project is named sample
In my maven repo (DSNexus) as expected, but the publish fails as it tries to publish the pom file:
sample-0.0.16.pom
Twice, for which the repo doesn’t allow (it’s a release repo, not snapshot). How can I do what I want without it failing? To be honest, I could actually not publish the pom at all as I don’t need it in this scenario.
Hi - thanks for the response. Yes, ultimately it’s two completely different builds. One will run on Linux and compile C++ using gcc, the other will run on Windows and compile C++ using Visual Studio.
What’s odd is that uploading two artifacts, differing only by classifier works absolutely fine, it’s the fact they both share the same pom file that causes the issue.
So what’s happening is:
Linux build runs, publishes sample-0.0.16-linux-binary.zip and a pom called sample-0.0.16.pom.
Then…
Windows build runs, publishes sample-0.0.16-windows-binary.zip which works fine but then it fails when trying to upload what is now a duplicate pom file i.e sample-0.0.16.pom.
Two solutions I was hoping someone might explain how to do:
Don’t publish a pom at all, I don’t actually need it here.
Somehow derive the pom file name from the artifact i.e sample-windows-0.0.16.pom and sample-linux-0.0.16.pom
As the maven repository format dictates the name of the POM file, I guess you cannot change it.
And as far as I know you also cannot not upload it, as it is required by the maven repository format.
I guess you wither have to have a catch-all project that gets the ready-built artifact from both builds and then publishes them in one go, or you have to publish both artifacts at different coordinates.