The project version can be set in a Maven pom.xml file, by calling maven with the version:set parameter.
mvn versions:set -DnewVersion=1.0.1-SNAPSHOT
The script takes a demo project created by maven, the default version number is 1.0-SNAPSHOT. It sets the project version number to 1.0.1-SNAPSHOT.
$ mvn versions:set -DnewVersion=1.0.1-SNAPSHOT [INFO] Scanning for projects... [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building my-app 1.0-SNAPSHOT [INFO] ------------------------------------------------------------------------ [INFO] [INFO] --- versions-maven-plugin:2.3:set (default-cli) @ my-app --- [INFO] Searching for local aggregator root... [INFO] Local aggregation root: v:\oliviertech\test\my-app [INFO] Processing change of com.mycompany.app:my-app:1.0-SNAPSHOT -> 1.0.1-SNAPSHOT [INFO] Processing com.mycompany.app:my-app [INFO] Updating project com.mycompany.app:my-app [INFO] from version 1.0-SNAPSHOT to 1.0.1-SNAPSHOT [INFO] [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 4.500 s [INFO] Finished at: 2017-04-13T11:26:38-07:00 [INFO] Final Memory: 14M/477M [INFO] ------------------------------------------------------------------------