How do I set a Maven dependency version programmatically?

后端 未结 1 1731
南旧
南旧 2021-01-06 09:28

Let\'s take this example:


    
        org.slf4j
        slf4j-api<         


        
相关标签:
1条回答
  • 2021-01-06 09:58

    You can simply use the following command:

    mvn versions:use-dep-version -Dincludes=junit:junit -DdepVersion=1.0 -DforceVersion=true
    

    In includes is given like this: groupId:artifactId but can be something like this (quote from the docs):

    A list of artifact patterns to include. Follows the pattern "groupId:artifactId:type:classifier:version".

    The issue related to that is that via forceVersion any check which will be turned off to validate the version you have given to the versions which is available for the artifact so use it with care.

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