How can I update a property in a Maven POM?

后端 未结 7 661
耶瑟儿~
耶瑟儿~ 2020-12-13 18:23

I have two top-level Maven projects, backend and frontend, that advance versions at their own individual pace. Since each has multiple modules, I d

7条回答
  •  庸人自扰
    2020-12-13 19:00

    When you define your property in the pom.xml you must declare as an interval if you want that update-property works.

    I mean, sure your frontend.version is defined as follow:

    0.13.1
    

    Then the plugin when you set -DnewVersion=0.13.2 does not recognise the value as valid value. Instead of if you define as a interval, the plugin works.

    [0.13.0,0.13.2]
    

    In one of my test i get the following result:

    mvn versions:update-property -Dproperty=absis.version -DnewVersion=[2.20.4] -X
    
    
        [DEBUG] Property ${test.version}: Set of valid available versions is [2.19.0-RC-REVISION-1, 2.19.0-RC0.1, 2.19.0-RC0.2, 2.19.0-RC0.3, 2.19.0-RC0.4, 2.19.0-RC0.5, 2.19.0-RC0.6, 2.19.0-RC0.7, 2.19.0-RC1, 2.19.0-RC2, 2.19.0-RC3, 2.19.0, 2.19.0-revision, 2.19.0-revision2, 2.19.0.2, 2.19.1, 2.19.2, 2.19.3, 2.19.4, 2.20.0-RC0, 2.20.0-RC0.1, 2.20.0-RC1, 2.20.0-RC2, 2.20.0-RC3, 2.20.0, 2.20.0-PRUEBA-VERSION, 2.20.0-PRUEBA-VERSION-2, 2.20.0-PRUEBA-VERSION-3, 2.20.0i-RC1, 2.20.0i-RC1.1, 2.20.0i, 2.20.0i.2, 2.20.1, 2.20.2, 2.20.4, 2.20.5, 2.20.5-LT, 2.20.5.1, 2.20.6i-RC1, 2.21.0-RCtest1, 2.21.0-RCtest2]
    [DEBUG] Property ${test.version}: Restricting results to [2.20.4,2.20.4]
    [DEBUG] Property ${test.version}: Current winner is: 2.20.4
    [DEBUG] Property ${test.version}: Searching reactor for a valid version...
    [DEBUG] Property ${test.version}: Set of valid available versions from the reactor is []
    [INFO] Updated ${test.version} from [2.19.0,2.21.0-SNAPSHOT] to 2.20.4
    

    Buy you need to change the property value to a range.

    It's a shame because I can't use range in my poms definition.

提交回复
热议问题