Facilitate manipulation such as managing POM dependencies through CLI (command line interface)
Tip
|
In order to make easier the plugin utilization we can register the groupId into the <settings >
<!-- snipped -->
<pluginGroups>
<pluginGroup>br.org.soujava</pluginGroup>
</pluginGroups>
<!-- snipped -->
</settings> With that, we will be able to perform the plugin by using its prefix. So, instead of to perform the plugin by the following command: mvn br.org.soujava:pom-editor-maven-plugin:<GOAL> We may perform it just providing its prefix like below: mvn pom-editor:<GOAL> In the documentation, we’ll assume that you have done this configuration. |
Let’s suppose that you need to add JUnit Jupiter version 5.9.2 into your POM in the test scope, you could perform the following command inside on the target maven project:
mvn pom-editor:add-dep -Dgav='org.junit.jupiter:junit-jupiter:5.9.2' -Dscope=test
Parameter | Description | Required | Default |
---|---|---|---|
gav |
Dependency coordinates. Supported format: |
Yes |
|
pom |
Target POM file. |
No |
pom.xml |
scope |
The scope of the dependency - compile, runtime, test, system, and provided |
No |
|
type |
The type of dependency, that will be mapped to a file extension, an optional classifier and a few other attributes |
No |
|
classifier |
The classifier of the dependency. It is appended to the filename after the version. |
No |
Let’s suppose that you need to add a property to your pom file.
mvn pom-editor:change-prop -Dproperty='custom-property' -Dvalue='Caesar'
Parameter | Description | Required | Default |
---|---|---|---|
pom |
Target POM file. |
No |
pom.xml |
property |
The name of the property |
Yes |
|
value |
The value of the property, if not specified, the request is to delete the property if it exists. |
No |
When you perform the goal add-dep with the command below:
$ mvn pom-editor:add-dep -Dgav='junit:junit:4.13'
The plugin will create a backup POM file based on the target POM if such one doesn’t exist.
$ tree .
.
├── pom.xml
└── pom.xml.backup
You could perform multiple times the add-dep goal as you need.
Then, when you’re done, if there’s no problem with the changed POM, you could confirm the changes by performing the commit goal.
$ mvn pom-editor:commit
It covers the following goals:
-
Add/Change dependencies at POM.xml
-
Rollback/Commit changes at POM.xml
Take a look at here for more information.
The Code of Conduct of this project is adapted from the Contributor Covenant, version 1.4, available at here.
We are very happy you are interested in helping us and there are plenty ways you can do so.
-
Open an Issue: Recommend improvements, changes and report bugs
-
Open a Pull Request: If you feel like you can even make changes to our source code and suggest them, just check out our contributing guide to learn about the development process, how to suggest bugfixes and improvements.
Join the SouJava Discord server and say hello at #pom-editor-maven-plugin
channel!