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

pkauko picture pkauko · Sep 21, 2012 · Viewed 8.6k times · Source

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.

Answer

David Bejar picture David Bejar · Sep 21, 2012

One workaround that should work if indeed -Dmaven.skip.deploy=true work for you is:

In your Jenkins job configuration go to Build click on Advanced... and enter that -Dmaven.skip.deploy=true inside the MAVEN_OPTS field.