Set the version of a dependency from command line

前端 未结 1 1896
生来不讨喜
生来不讨喜 2021-01-15 13:37

I would like to set the version of a dependency in a POM from command line. Much like versions:set (for the version of the project), but for a specific dependen

相关标签:
1条回答
  • 2021-01-15 14:14

    If you know your dependency versions are specified in the dependency or dependencyManagement blog and the version is not a property you can use use-dep-version:

    mvn versions:use-dep-version -Dincludes=io.netty:netty-all -DdepVersion=1.0 -DforceVersion=true
    

    However if the version is specified as a property, the use-dep-version will not work.

    Then you can only use versions:*-property commands but for this you need to know the name of the property (which could be achieved by having a naming convention for these properties)

    mvn versions:set-property -DnewVersion=1.0 -Dproperty=netty-all.version
    

    if you need more safety that the version you will use is valid or to avoid downgrades have a look at update-property.

    If you project is mixed with versions and property versions you could just run both commands and one will change it.

    0 讨论(0)
提交回复
热议问题