An open API service indexing awesome lists of open source software.

https://github.com/soujava/pom-editor-maven-plugin

It's a Maven Plugin to allowing POM editions
https://github.com/soujava/pom-editor-maven-plugin

Last synced: 6 months ago
JSON representation

It's a Maven Plugin to allowing POM editions

Awesome Lists containing this project

README

        

= POM Editor Maven Plugin
:toc: auto

image:https://img.shields.io/badge/1.0.0--SNAPTHOT-HTML%20--%20Plugin%20Documentation-blue[Documentation,link=https://soujava.github.io/pom-editor-maven-plugin/plugin-info.html, window=_blank, target=_blank]

image:https://img.shields.io/maven-central/v/br.org.soujava/pom-editor-maven-plugin?style=flat-square[Maven Central, link=https://central.sonatype.com/search?smo=true&namespace=br.org.soujava&q=br.org.soujava, window=_blank, target=_blank] image:https://img.shields.io/maven-metadata/v?label=s01.oss.sonatype.org&metadataUrl=https%3A%2F%2Fs01.oss.sonatype.org%2Fcontent%2Frepositories%2Fsnapshots%2Fbr%2Forg%2Fsoujava%2Fpom-editor-maven-plugin%2Fmaven-metadata.xml&style=flat-square[Maven SNAPSHOT Repo,link=https://bit.ly/3oxRi0X, window=_blank, target=_blank]

image:https://github.com/soujava/pom-editor-maven-plugin/actions/workflows/java-11.yml/badge.svg[ link=https://github.com/soujava/pom-editor-maven-plugin/actions/workflows/java-11.yml, window=_blank, target=_blank] image:https://github.com/soujava/pom-editor-maven-plugin/actions/workflows/java-17.yml/badge.svg[ link=https://github.com/soujava/pom-editor-maven-plugin/actions/workflows/java-17.yml, window=_blank, target=_blank] image:https://github.com/soujava/pom-editor-maven-plugin/raw/coverage/jacoco_java-11.svg[ link=https://soujava.github.io/pom-editor-maven-plugin/jacoco/index.html, window=_blank, target=_blank] image:https://github.com/soujava/pom-editor-maven-plugin/raw/coverage/branches_java-11.svg[ link=https://soujava.github.io/pom-editor-maven-plugin/jacoco/index.html, window=_blank, target=_blank]

== Introduction

Facilitate manipulation such as managing POM dependencies through CLI (command line interface)

== How to use it

[TIP]
===============================
In order to make easier the plugin utilization we can register the groupId into the `settings.xml` like the snipped code below:
[source,xml]
----



br.org.soujava

----
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:
[source, sh]
----
mvn br.org.soujava:pom-editor-maven-plugin:
----
We may perform it just providing its prefix like below:
[source, sh]
----
mvn pom-editor:
----
In the documentation, we'll assume that you have done this configuration.
===============================

=== Add/Change a dependency

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:

[source, sh]
----
mvn pom-editor:add-dep -Dgav='org.junit.jupiter:junit-jupiter:5.9.2' -Dscope=test
----

.add-dep supported parameters
[cols="add-dep params"]
|===
|Parameter | Description | Required | Default

| gav
| Dependency coordinates. Supported format: `groupId:artifactId:version`
| 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
|

|===

=== Add/Change/Remove a property

Let's suppose that you need to add a property to your pom file.

[source, sh]
----
mvn pom-editor:change-prop -Dproperty='custom-property' -Dvalue='Caesar'
----

.change-prop supported parameters
[cols="change-prop params"]
|===
|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
|

|===

=== Confirm the changes

When you perform the goal add-dep with the command below:

[source,sh]
$ 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.

[source,sh]
$ 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.

[source,sh]
$ mvn pom-editor:commit

=== Revert the changes

You could also perform the rollback goal:

[source,sh]
$ mvn pom-editor:rollback

This goal will revert the changes, replacing the changed POM file to the backup POM file.

== Goals

It covers the following goals:

* Add/Change dependencies at POM.xml
* Rollback/Commit changes at POM.xml

== Code of Conduct

Take a look at link:CODE_OF_CONDUCT.adoc[here] for more information.

The Code of Conduct of this project is adapted from the link:https://www.contributor-covenant.org[**Contributor Covenant**], version 1.4, available at link:http://contributor-covenant.org/version/1/4[here].

== Contributing

We are very happy you are interested in helping us and there are plenty ways you can do so.

- https://github.com/soujava/pom-editor-maven-plugin/issues[**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 link:CONTRIBUTING.adoc[contributing guide] to learn about the development process, how to suggest bugfixes and improvements.

== Contact

Join the link:https://discord.gg/eAARnH7yrG[SouJava Discord server] and say hello at `#pom-editor-maven-plugin` channel!