Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to disable the deploy goal of maven-deploy-plugin via settings.xml

I tried adding this to the settings.xml;

<properties>
    <maven.deploy.skip>true</maven.deploy.skip>
</properties>

But that didn't work. mvn deploy -Dmaven.skip.deploy=true seems to work ok. Also I assume that adding the above tag to the pom.xml would work also. Is there a way to achieve this using the settings.xml?

Reason for me to want to do this is to force people generating Jenkins jobs to have to use the Jenkins' method for deploying artifacts and not use the deploy goal. The Jenkins' method will deploy the artifacts only when the whole build has succeeded, but the deploy goal can deploy artifacts even when the rest of the build is about to fail. I'm open to suggestions on other ways to achieve this apart from preventing normal users from creating and configuring jobs in Jenkins.

like image 991
pkauko Avatar asked Sep 21 '12 07:09

pkauko


People also ask

What are the goals of the Maven deploy plugin?

Goals Overview deploy:deploy is used to automatically install the artifact, its pom and the attached artifacts produced by a particular project. Most if not all of the information related to the deployment is stored in the project's pom. deploy:deploy-file is used to install a single artifact along with its pom.

What does mvn clean deploy do?

clean : removes files generated at build-time in a project's directory ( target by default) install : installs the package into the local repository, for use as a dependency in other projects locally.

Where does mvn deploy deploy to?

The maven deploy plugin can be used to deploy either files or projects to the remote repository for sharing it with other developers and projects. There are various methods can be used to deploy your artifact to the remote repository by using a maven deploy plugin.

What is the difference between mvn install and mvn deploy?

mvn:install copies your packaged Maven module to your local repository (by default, in ~/. m2/repository ), to be accessed by other local Maven builds. mvn:deploy uploads your packaged Maven module to another (usually remote) repository, to be accessed by other, not necessarily local, Maven builds.


1 Answers

The following worked for me after a long battle.

 -Dskip.deploy=true

The following didn't work.

-Dmaven.skip.deploy=true
-Dmaven.deploy.skip=true
like image 66
Nhlanhla Rihlapfu Avatar answered Oct 15 '22 09:10

Nhlanhla Rihlapfu