andreas
andreas

Reputation: 1585

pimp up a plain jar to be a maven jar with internal pom.xml for Artifactory

I need to use a xyz.jar wich was generated with ant. Hence, the transitive dependencies are missing. So I had the idea, to modify the xyz.jar to add the internal META-INF/maven/groupId/artifactId/pom.xml and pom.properties files.

When I deployed it to Artifactory, it ignored them and generated it's own pom.xml without dependencies.

What has one to do, Artifactory deploys the pom.xml lying about in the same folder as the xyz.jar file?

Lost way too much time on this allready...

Upvotes: 3

Views: 785

Answers (3)

noamt
noamt

Reputation: 7815

Chances are that Artifactory skips the deployment of the internal POM because it cannot read the POM's physical size from the archive (done for historical reasons); You can verify this by looking at the log for a warning message along the lines of:

"Found pom.xml file with size -1 inside the zip. Ignoring"

If you've already gone to the lengths of creating a customized POM file, you can paste it's contents in the POM content editor of the artifact deployer or deploy it independently; though the first option will give you the benefit of auto detecting the deployment coordinates for the JAR file.

Upvotes: 2

aviad
aviad

Reputation: 8278

modify the ant that create an xyz.jar to produce runnable jar - the jar should have all its deppendencies packaged inside.(create a lib directory in your xyz project and put all the jars xyz deppends on inside this directory, then export your project to jar with all the libraries packaged inside) good step-by-step example how to create an ant script can be found here.

good luck!

Upvotes: 0

Jon7
Jon7

Reputation: 7215

It might be a better idea to add it's dependencies to your pom instead of rigging a third-party library to use maven.

That being said, make sure your pom.xml is valid XML (most modern IDEs can validate xml for you) and make sure your properties file includes version, group id, and artifact id.

Artifactory has changed the way that it handles POM generation in different versions, so, depending on your version, you may have some sort of generate pom option that you have to turn off on deploy. I think they have a deploy time pom editor or something like that in the newer versions.

Upvotes: 0

Related Questions