Reputation: 399
I've been trying to figure this out for a few days now, I have looked all over stackoverflow and none of the answers fix my issue. I am trying to have the <version>
in my Pom.xml.
<project xmlns="http://maven.apache.org/POM/4.0.0"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>maven.Test</groupId>
<artifactId>Hello</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>jar</packaging>
<distributionManagement>
<repository>
<id>Artifactory</id>
<name>Artifactory-releases</name>
<url>${publish.location}</url>
</repository>
<snapshotRepository>
<id>Artifactory</id>
<name>Artifactory-snapshots</name>
<url>${publish.location}</url>
</snapshotRepository>
</distributionManagement>
</project>
I am using Maven 3.3.3 currently, I have looked into SCM plugins but those don't seem to be working. I know you can have it increment versions by setting them as variables but that isn't ideal for my developers. When a build is run using the command mvn deploy
I want the version to auto increment to 1.0.1 and so on.
EDIT:
I tried doing the maven release but am running into an issue which may be on me. For the release plugin are there edits I need to make to my Pom.xml? I ran mvn release:prepare
but ran into this error:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.3
.2:prepare (default-cli) on project Hello: Unable to check for local modificatio
ns
[ERROR] Provider message:
[ERROR] The svn command failed.
[ERROR] Command output:
[ERROR] 'svn' is not recognized as an internal or external command,
[ERROR] operable program or batch file.
Upvotes: 20
Views: 46837
Reputation: 707
@Michael-O has answered the original question. However, the error 'svn' is not recognized as an internal or external command,
is occurred because Maven can not execute svn command line. To solve this problems add svn in your PATH environment variable. Usually if you install sliksvn client, It will add the path for you. In addition to @Michael-O, you may have to include username and password.
mvn -B -Dpassword=**** -Dusername=**** clean release:prepare release:perform
If the subversion server certificate is rejected, you have to add the server certificate to svn configuration. The easiest way is by executing svn from command line and accept the certificate when prompted by the svn client.
Upvotes: 3
Reputation: 18405
Picking up @rec's answer:
Use:
$ mvn -B release:prepare release:perform
Note the -B
. It will run in batch mode and the release plugin won't ask at all.
Upvotes: 9
Reputation: 10895
Versions are increased as part of the "release" workflow. Check out the Maven Release Plugin. In short:
$ mvn release:prepare
$ mvn release:perform
The release plugin will increment the version but ask you for confirmation, so it is not fully automatic.
Upvotes: 6