How to deploy locally already installed artifact with Maven
Asked Answered
A

2

9

Story

I know, that maven deploy command runs through the whole lifecycle. My problem, that it takes to much time in my case. Let me explain:

  • There is an application built up from a Server, and a single sourced Eclipse RAP&RCP client
  • The communication is defined by shared API projects which are built together with the Server, but also needed by the GUI projects
  • The GUI projects are built by Tycho, so its impossible to build both of them in one build (in one reactor, EDIT: since the P2 artifacts are different for RCP and RAP)
  • I build a release with a multi step Jenkins build. To make sure, that everything is fine I first make a clean install for Server and the GUI variations one by one, and then I deploy them, if nothing fails

Question

Building everything twice takes a lot of time. Is there anything like "please simply deploy all built artifacts as they are from my local repository to the POM defined repository with skipping the whole lifecycle"?

Adaadabel answered 7/3, 2013 at 21:1 Comment(5)
It sounds to me that you didn't understand the maven lifecycle, cause if you call mvn deploy the install is part of that. So it does not make sense to call first mvn install and afterwards mvn deploy.Russi
I added a small edit to make it more clear.Goalie
are you using a repository manager such as Artifactory or Nexus?Senate
We are using the free version of Nexus.Goalie
See my other question and answer at https://mcmap.net/q/1316921/-staged-deployment-of-snapshot-artifacts-with-maven-and-jenkinsGoalie
D
7

If you have the artifact already by the previous build, you may consider the deploy:deploy-file by following the Guide to deploying 3rd party JARs to remote repository. I always use this goal to publish some stable artifact to the developer public remote repository for letting other team to test/use.

I hope this may help.

Dewain answered 8/3, 2013 at 0:46 Comment(1)
Looks like if you're trying ACTUALLY deploy the artifacts currently installed in your .m2/repository maven complains with an error: ```Cannot deploy artifact from the local repository`` (trying to find a workaround for it)Amice
S
2

I don't think that there is a pure Maven solution to this. The problem is that your deploy only build won't know which artifacts to deploy – AFAIK this information is only in the in-memory Maven model and not persisted to the target folder.

The problem can be solved with a Maven repository manager that supports staging, like the (commercial) Nexus Pro. Then, your build would deploy straight away into a staging repository, and only promote the artifacts to the (main) repository if everything succeeded.

Stephi answered 8/3, 2013 at 8:4 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.