/mvn-deps-tool

Tool for replacing dependencies in maven project

Primary LanguageGroovyApache License 2.0Apache-2.0

mvn-deps-tool

Tool for replacing dependencies in maven project

Usage

groovy mvn-deps-tool.groovy <command> <maven project> <file with maven dependencies>
  • <command> - you can use replace or bom, see How it Works for explanation what each command does
  • <maven project> - path to the maven project for example: ~/Projects/projectName
  • <file with maven dependencies> - file which contains replacing dependencies in the format groupId:artifactId:version

How it works

  • The tool traverses all pom.xml files in your maven project and it parses all dependencies from these poms.
  • Dependencies are searched in /project/dependencies and /project/dependencyManagement/dependencies.
  • Dependencies witout version are skipped, because version is inherited from dependencyManagement.
  • Tool reads <file with maven dependencies> and it tries to find each dependency in the project. If the dependency is found, the tool modifies version of the dependency in all occurences.
  • Finally if you used
    • replace command - all changes are persisted to the disc (poms are replaced).
    • bom command - the bom with dependencies is printed to standard output. You can use POM manipulation extension for replacing versions of dependencies.

Limitation

  • All poms must be valid XML files.