Frequently Asked Questions
- When releasing from a parent POM, won't all its modules have the same release version and dev version as this parent?
- How can I release a parent POM without releasing all its modules?
- How can I hide my username and password?
- How can I customize the comment prefix of a commit during release preparation?
- Why is
release:preparefailing when trying to tag with"svn: Path '...' does not exist in revision ..."? - Can I use a plugin other than Maven Deploy Plugin for deployment?
- When releasing from a parent POM, won't all its modules have the same release version and dev version as this parent?
-
By default Maven Release Plugin will prompt for each project's version. However, you can set the
autoVersionSubmodulesparameter totrueto automatically use the parent version. - How can I release a parent POM without releasing all its modules?
-
You need to pass the
-Nflag to Maven and configure the Release Plugin to pass the-Nflag on its forked builds with the-Dargumentsflag.Here's an example:
mvn -N -Darguments=-N release:prepare mvn -N -Darguments=-N release:perform - How can I hide my username and password?
-
Add a server-entry to your
settings.xml, where you define your credentials (see settings.xml#servers for more details). Since you can't set an id for thescmin yourpom.xml, you should add a property pointing to the server-id.<project> ... <properties> <project.scm.id>my-scm-server</project.scm.id> </properties> </project> - How can I customize the comment prefix of a commit during release preparation?
-
By default the plugin will prefix the comment with
[maven-release-plugin]. You can change this by adding-DscmCommentPrefix=#42to the Maven command.
If you need to end this with a linebreak, add${line.separator}.
If the comment prefix contains whitespace characters, surround the argument with quotes.When using the plugin-configuration, you can't end with a space, because Plexus will trim the content. But you can end with a linebreak just like the example below:
<configuration> <scmCommentPrefix>#42${line.separator}</scmCommentPrefix> ... </configuration> - Why is
release:preparefailing when trying to tag with"svn: Path '...' does not exist in revision ..."? -
If the
pom.xmlhas no scm-section but inherits one from its parent, the prepare goal will fail when trying to tag. The message will be something like:svn: Path '...' does not exist in revision ...
To fix it, roll-back the release, add the
scmsection to thepom.xml, commit and retry the release. - Can I use a plugin other than Maven Deploy Plugin for deployment?
-
Yes, you can use any other plugin for deployment. There is no strong interconnection between the Maven Release Plugin and the Maven Deploy Plugin. The Maven Release Plugin simply runs the
deployMaven goal during release (or any other goals you specified). This allows you for example to use thecentral-publishing-maven-pluginwhen deploying to Maven Central.However, it might be necessary to configure the Maven Deploy Plugin to skip execution because the plugin is automatically configured by default (note that some custom deploy plugins automatically disable the Maven Deploy Plugin):
<build> <pluginManagement> <plugins> <!-- Skip execution of Maven Deploy Plugin due to usage of custom deploy plugin --> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-deploy-plugin</artifactId> <version>...</version> <configuration> <skip>true</skip> </configuration> </plugin> </plugins> </pluginManagement> </build>



