pom-yml-maven-extension

pom.yml maven extension

License

License

Categories

Categories

Maven Build Tools
GroupId

GroupId

org.metalib.maven.extention
ArtifactId

ArtifactId

pom-yml-maven-extension
Last Version

Last Version

0.0.9
Release Date

Release Date

Type

Type

jar
Description

Description

pom-yml-maven-extension
pom.yml maven extension
Project URL

Project URL

https://github.com/org-metalib/pom-yml-maven-extension
Source Code Management

Source Code Management

https://github.com/org-metalib/pom-yml-maven-extension

Download pom-yml-maven-extension

How to add to project

<!-- https://jarcasting.com/artifacts/org.metalib.maven.extention/pom-yml-maven-extension/ -->
<dependency>
    <groupId>org.metalib.maven.extention</groupId>
    <artifactId>pom-yml-maven-extension</artifactId>
    <version>0.0.9</version>
</dependency>
// https://jarcasting.com/artifacts/org.metalib.maven.extention/pom-yml-maven-extension/
implementation 'org.metalib.maven.extention:pom-yml-maven-extension:0.0.9'
// https://jarcasting.com/artifacts/org.metalib.maven.extention/pom-yml-maven-extension/
implementation ("org.metalib.maven.extention:pom-yml-maven-extension:0.0.9")
'org.metalib.maven.extention:pom-yml-maven-extension:jar:0.0.9'
<dependency org="org.metalib.maven.extention" name="pom-yml-maven-extension" rev="0.0.9">
  <artifact name="pom-yml-maven-extension" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.metalib.maven.extention', module='pom-yml-maven-extension', version='0.0.9')
)
libraryDependencies += "org.metalib.maven.extention" % "pom-yml-maven-extension" % "0.0.9"
[org.metalib.maven.extention/pom-yml-maven-extension "0.0.9"]

Dependencies

compile (7)

Group / Artifact Type Version
com.fasterxml.jackson.core : jackson-annotations jar 2.11.0
com.fasterxml.jackson.core : jackson-core jar 2.11.0
com.fasterxml.jackson.core : jackson-databind jar 2.11.0
com.fasterxml.jackson.dataformat : jackson-dataformat-yaml jar 2.11.0
com.fasterxml.jackson.datatype : jackson-datatype-jdk8 jar 2.11.0
org.apache.maven : maven-core jar 3.6.3
org.codehaus.plexus : plexus-component-annotations jar 2.1.0

provided (1)

Group / Artifact Type Version
org.projectlombok : lombok jar 1.18.12

test (1)

Group / Artifact Type Version
junit : junit jar 4.13

Project Modules

There are no modules declared in this project.

pom-yaml maven extension

pom.yml

pom-yaml-maven-extension introduces pom.yml configuration that accompanies pom.xml. The configuration is yet another way to replace what you can achieve using maven command line parameters.

  1. Maven goals (before and after)
  2. Maven profile
  3. User properties
  4. System properties

Goals

pom.yml allows to configure so called before goals and after goals. before goals are injected by the plugin before the command line goals. Respectively, after goals are injected after the command line goals. If user does not provide any goals in command line the extension injects goals from on-empty list. It's helpful to produce an output info about the project.

Example:

session:
  goals:
    before:
      - clean
    after:
      - sonar:sonar
    on-empty:
      - help:effective-settings

So the following maven command line withe the pom.xml above

mvn install

will be the same as you would try to execute the following:

mvn clean install sonar:sonar

Project GIT url

If there is a user property pom-yaml.scm.git.load-git-url set to true the extension parses git configuration file .git/config and extracts a URL from [remote "origin"] section and set the URL value to pom-yaml.scm.git.git-url user project.

mvn clean install -Dpom-yaml.scm.git.load-git-url=true

if project has .git/config file accessible and remote repository is set then you can use a remote URL value in pom-yaml.scm.git.git-url in the pom.xml. It sets the following properties:

Name Description
pom-yaml.scm.git.git-url project scm url
pom-yaml.scm.git.git-url.path project scm url path
pom-yaml.scm.git.git-url.ext project scm url extension (.git)
pom-yaml.scm.git.git-url.host project scm url host
pom-yaml.scm.git.git-url.schema project scm url schema
pom-yaml.scm.git.git-url.port project scm url port
pom-yaml.scm.git.git-url.user project scm url user

Installation

Follow maven guidance to setup maven extension as described in Maven Extension Demo Study. To configure the extension, use ${maven.projectBasedir}/.mvn/extensions.xml method.

Example of .mvn/extensions.xml configuration file:

<extensions xmlns="http://maven.apache.org/EXTENSIONS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/EXTENSIONS/1.0.0 http://maven.apache.org/xsd/core-extensions-1.0.0.xsd">
    <extension>
        <groupId>org.metalib.maven.extension</groupId>
        <artifactId>pom-yml-maven-extension</artifactId>
        <version>0.0.10</version>
    </extension>
</extensions>

Example

This pom.yml activates maven-surefire-plugin-skip and sonar-skip maven profiles and deactivates docker-skip. It sets up maven.test.skip maven property to true.

---
session:
  goals:
    before:
      - clean
    after:
      - install
    on-empty:
      - help:effective-settings
  profiles:
    active:
      - maven-surefire-plugin-skip
      - sonar-skip
    inactive:
      - docker-skip
  user-properties:
    maven.test.skip: true
  system-properties:
    checksum: 0000

The example above is equivalent to the following command line maven call:

mvn -Pmaven-surefire-plugin-skip,sonar-skip,!docker-skip -Dmaven.test.skip=true

References

org.metalib.maven.extention

metalib.org

Versions

Version
0.0.9
0.0.8
0.0.7
0.0.6
0.0.5
0.0.4
0.0.3
0.0.2
0.0.1