Maven deploy using profile

1.4k Views Asked by At

I want to deploy to a private Maven repository only if there is a defined profile.

Is this possible? And how can I do it?

2

There are 2 best solutions below

0
Erik Geletti On

Maybe you can use the skip property described here: https://maven.apache.org/plugins/maven-deploy-plugin/deploy-mojo.html#skip

mvn deploy -Dmaven.deploy.skip=true
0
xwine On

put the repository into profile

<profiles>
  <profile>
    <id>test</id>
    <distributionManagement>
       <repository>
           <id>repsy</id>
           <name>My Private Maven Repository on Repsy</name>
           <url>https://repo.repsy.io/mvn/username/reponame</url>
      </repository>
    </distributionManagement>
  </profile>
</profiles>

you can execute :mvn deploy -P test,it will use the repo in the test profile.