Home > Software engineering >  maven deploy to private repo with parameter
maven deploy to private repo with parameter

Time:09-17

I am new to maven and I want to deploy to a private maven repository repsy.io only if there is a defined parameter with the value true, for example mvn deploy parameter=true.

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

Is this possible? And how can I do it?

CodePudding user response:

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

CodePudding user response:

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.

  • Related