I have a multi-module project with a root pom.xml
, defined with <packaging>pom</packaging>
, and several <modules>
.
On Jenkins, I run maven with the goals jar:jar install:install -Dmaven.test.skip=true
(compiling and testing was already done by previous jobs in the build pipeline).
As a post-build action, I deploy artifacts to Artifactory. I checked 'Deploy Maven artifacts' and left include/exclude blank so it will take the defaults.
The submodules correctly have their pom and jar deployed to Artifactory. I see this in the console output:
Deploying artifacts of module: com.example:foo
Deploying artifact: https://repo.example.com/snapshot/com/example/foo/7.0.0-SNAPSHOT/foo-7.0.0-SNAPSHOT.jar
Deploying artifact: https://repo.example.com/snapshot/com/example/foo/7.0.0-SNAPSHOT/foo-7.0.0-SNAPSHOT.pom
The root
pom is not correctly uploaded to Artifactory.
When "Supress POM Consistency Checks" is off, the build fails with a conflict on the root
pom:
Deploying artifacts of module: com.example:root
Deploying artifact: https://repo.example.com/snapshot/com/example/root/7.0.0-SNAPSHOT/root-7.0.0-SNAPSHOT.pom
ERROR: Failed to deploy file: HTTP response code: 409. HTTP response message: Conflict
java.io.IOException: Failed to deploy file: HTTP response code: 409. HTTP response message: Conflict
at org.jfrog.build.extractor.clientConfiguration.client.ArtifactoryBuildInfoClient.throwHttpIOException(ArtifactoryBuildInfoClient.java:743)
at org.jfrog.build.extractor.clientConfiguration.client.ArtifactoryBuildInfoClient.uploadFile(ArtifactoryBuildInfoClient.java:623)
at org.jfrog.build.extractor.clientConfiguration.client.ArtifactoryBuildInfoClient.deployArtifact(ArtifactoryBuildInfoClient.java:329)
at org.jfrog.hudson.maven2.ArtifactsDeployer.deployArtifact(ArtifactsDeployer.java:190)
at org.jfrog.hudson.maven2.ArtifactsDeployer.deploy(ArtifactsDeployer.java:130)
at org.jfrog.hudson.ArtifactoryRedeployPublisher.perform(ArtifactoryRedeployPublisher.java:420)
at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:782)
at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:723)
at hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.post2(MavenModuleSetBuild.java:1047)
at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:668)
at hudson.model.Run.execute(Run.java:1763)
at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:531)
at hudson.model.ResourceController.execute(ResourceController.java:98)
at hudson.model.Executor.run(Executor.java:410)
Build step 'Deploy artifacts to Artifactory' changed build result to FAILURE
When "Supress POM Consistency Checks" is on, I check root
on Artifactory and I go to "POM View", then I see binary garble starting with "PK", which indicates a ZIP file or in this case probably a JAR file. Downloading that file and extracting as zip confirmed that it contains a META-INF
directory with some subdirectories related to Maven.
What I was expecting, was a plain text pom.xml
for root
.
I also noticed this in the console log:
[JENKINS] Archiving /var/lib/jenkins/jobs/example-develop-maven-artifactory/workspace/target/example-root-7.0.0-SNAPSHOT.jar to com.example/root/7.0.0-SNAPSHOT/root-7.0.0-SNAPSHOT.pom
and then
Deploying artifacts of module: com.example:root
Deploying artifact: https://repo.example.com/snapshot/com/example/root/7.0.0-SNAPSHOT/root-7.0.0-SNAPSHOT.pom
Deploying artifact: https://repo.example.com/snapshot/com/example/root/7.0.0-SNAPSHOT/root-7.0.0-SNAPSHOT.pom
As I understand it, Artifactory intercepts what the build tool deploys in the local repository (~/.m2
).
How do I get the pom, and only the pom, and no magically generated jar, of my root
, on Artifactory? Which probably boils down to, how do I tell Maven and/or Jenkins not to overwrite my root
pom with a root
jar?
Versions:
- Artifactory 3.4.2 (rev. 30140)
- Jenkins 1.643
- Artifactory Plugin 2.4.7
jar:jar install:install -Dmaven.test.skip=true
instead ofmvn clean install
or if you like to deploy those artifacts to repo manager just usemvn clean deploy
? – khmarbaisejar:jar install:install
takes 45 seconds, whileclean install
takes 4.5 minutes, with tests skipped (and 25 minutes with tests). – Amedee Van Gasse