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 dependency.
I don't want to craft any XML scanning tool because there are various ways to specify a version and it is hard to handle them all.
If you know your dependency versions are specified in the
dependencyordependencyManagementblog and the version is not a property you can use use-dep-version:However if the version is specified as a property, the
use-dep-versionwill not work.Then you can only use
versions:*-propertycommands but for this you need to know the name of the property (which could be achieved by having a naming convention for these properties)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.
UPDATE 2024: Maven goal
use-dep-versionnow has attribute processProperties, which if set totruewill cause also properties to be changed. There is no need for usingversions:*-propertyanymore.