Maven redistribute existing war

psuzzi :

I'm working on maven project, where I need to redistribute an existing Test.war archive with new GAV coordinates as a result of the build.

Since the Test.war is provided as is by another team (third party), I cannot refer such artifact using GAV coordinates. But, my build should be able to build/repackage the artifact using new, defined GAV coordinates (e.g. mygroup:myproject:1.0.0), so that after the build other projects can refer this artifact using the given GAV coordinates (through a nexus).

I think the right way to do so would be creating a new maven TestWarProject with war packaging and the desired GAV coordinates. But I have no idea on how I can "re-distribute" the original war as a result of the build of this project.

Is there anyone who can provide me a suggestion or an example on how I can re-deploy such war during the build?

Note: I need to have a real maven project that deploys the artifact under a new GAV, and I cannot I cannot execute a command like mvn deploy:deploy-file .. to alter the content of Nexus.

Mark Bramnik :

I assume by "re-distribute" you mean that your build needs to deploy the WAR to nexus under the different GAV.

In this case you might consider using mvn deploy:deploy-file plugin.

This goal of the deploy plugin installs the file into remote repository and allows specifing the GAV of the artifact file that you want to deploy.

When WAR is created it doesn't contain any GAV, the GAV is used solely to identify the artifact in the maven repo (remote or local).

You can find an example here

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=18613&siteId=1