maven release:prepare not deploying the projects with release version

放肆的年华 提交于 2019-12-21 05:13:10

问题


I have a flat project structure with multiple projects. I am using Nexus for internal repository and SVN for Source code management. I am able to deploy the SNAPSHOT build of my project.

In my parent pom i have added the maven release plug-in:

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-release-plugin</artifactId>
  <version>2.1</version>
</plugin>

and the distribution info:

<distributionManagement>
  <repository>
    <id>releases</id>
    <url>http://localhost:8081/nexus/content/repositories/releases</url>
  </repository>
  <snapshotRepository>
    <id>snapshots</id>
    <name>Internal Snapshots</name>
    <url>http://localhost:8081/nexus/content/repositories/snapshots</url>
  </snapshotRepository>
</distributionManagement>

When I am doing a mvn release:prepare, the artifacts with the release versions are not getting deployed to repo. So if I have a project A with dependency on project B. Project A is not able to get the artifact of B with the release version.


回答1:


The release:prepare by default calls "clean" and "verify" goals which simply tries to compile and run test. So nothing is deployed to your remote repository nor installed in your local repository. To handle dependencies in multi-module projects with the new release version you need to have things installed in local repository during release:prepare, so change the default goals to "clean" and "install" with the preparationGoals property.

<plugin>
    <artifactId>maven-release-plugin</artifactId>
    <version>2.1</version>
    <configuration>
       <preparationGoals>clean install</preparationGoals>
    </configuration>
</plugin>

You can add any goals you would need during your build.

The actual deployment to remote repository will be done by the release:perform goal.

Laurent



来源:https://stackoverflow.com/questions/4991640/maven-releaseprepare-not-deploying-the-projects-with-release-version

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!