Search code examples
mavenjenkinsartifactory

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.


Solution

  • Figured out how to do this using settings.xml. Had to insert the tags I mentioned inside an active profile.