Issue
I have a multi-module SpringBoot application that I deploy to artifactory. Unfortunately the upload to artifactory fails because the Jenkins build checks if the file exists and it doesn't because the file does not get uploaded.
Sub-module gets uploaded successfully:
[INFO] Uploading to snapshots: <jar path>
[INFO] Uploaded to snapshots: <jar path> (241 kB at 759 kB/s)
Main app module logs :
Uploading to snapshots: <jar>
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.8.2:deploy (default-deploy) on project <project>: Failed to deploy artifacts: Could not find artifact <application module jar> in snapshots (<artifactory path>) -> [Help 1]
As you can see above, for sub-modules I get also "Uploaded" message. For the main app module i get only "uploading", not "uploaded". Main difference that I can see is the size. SpringBoot app jar is 60MB and the sub-modules are KB. I think the build triggers the upload but then directly checks if it was uploaded but maybe the upload did not finish... What can I do to fix this and get a successfull build?
Solution
The problem was that I had double that defined the repositories, both in parent pom and in the application module pom. I don't know exactly why this caused Maven to block the upload of the jar to Artifactory but I am certain that this was the problem.
From my point of view, 2.8.2 is ok being the latest full release and there can be business reasons why we want to upload to Artifactory also SNAPSHOT versions.
Answered By - 2dor
Answer Checked By - Pedro (JavaFixing Volunteer)