Home > Back-end >  Maven upload 64MB jar does not finish
Maven upload 64MB jar does not finish

Time:08-12

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?

CodePudding user response:

Two suggestions:

  1. version 2.8.2 of maven-deploy-plugin was released in 2014 - 8 years ago, it is definitely worth to try update it (and maven as well)
  2. deploying SNAPSHOT versions does not make sense: there is no reliable way to work with SNAPSHOT dependencies, it is like playing improved russian roulette with five rounds in a revolver - there are only two states of such artifact cached locally: it either stale or you have no idea what has been changed.

Special note for guys who like to flirt with snapshot versions.

Snapshot concept have nothing in common with SDLC, that is just a poor attempt to place something unusable into another DML or partition.

If your need to build some kind of feature-preview/nightly releases maven does allow to do that without affecting entire SDLC:

mvn -e --batch-mode -Prelease release:clean release:prepare \
 -Darguments='-DaltReleaseDeploymentRepository=... -DaltSnapshotDeploymentRepository=...' \
# version convention for fp release
 -DreleaseVersion=1.0.0-${sha} \
# continue staying on snapshot version
 -DdevelopmentVersion=1.0.0-SNAPSHOT \
 -DpushChanges=false \
 -DpreparationGoals="clean deploy"

People who run mvn deploy against SNAPSHOT version just do not understand what they are really doing and what are the consequences. That should be at least mvn deploy -Dmaven.install.skip=true

CodePudding user response:

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.

  • Related