Maven release: do not plan to deploy projects with release version

I have a flat project structure with several projects. I use Nexus for the internal repository and SVN for source control. I can deploy the SNAPSHOT assembly of my project.

In my parent POM, I added the Maven Release plugin:

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

and distribution information:

 <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 do mvn release:prepare , artifacts with release versions are not deployed to the repo. Therefore, if I have a project A with a dependency on project B. Project A cannot get artifact B using the production version.

+4
source share
1 answer

Release: prepare calls by "clean" and "tested" targets by default, which simply try to compile and run the test. Therefore, nothing is deployed to your remote repository and is not installed in your local repository. To handle dependencies in multi-module projects with the new version, you need all things to be installed in the local repository at release time: prepare to change the default goals to β€œclear” and β€œset” using the prepareGoals property.

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

You can add any goals you need during the build.

The actual deployment to the remote repository will be done using the release: complete the goal.

Laurent

+9
source

Source: https://habr.com/ru/post/1339630/


All Articles