maven override project.version from command line

前端 未结 3 1305
长发绾君心
长发绾君心 2021-01-30 20:51

I wonder if it is possible to override project.version/version variable in maven via command line?

The following doesn\'t work:

mvn deploy -Dversion=1.         


        
3条回答
  •  执念已碎
    2021-01-30 21:34

    Yes, you can override the project version by passing the required variable from the command line.

    Make sure you are using the variable in your pom.xml

    Eg:

    mvn deploy -Dversion=1.0-test-SNAPSHOT 
    

    in pom.xml

    ${version}
    

    This should get picked during runtime. If this approach does not works, can you please show how you are using them in your pom.xml ?

提交回复
热议问题