resolved-pom-maven-plugin Maven Plugin

A maven plugin to filter specific properties in a pom files and attach the resulting pom to the build output

License

License

Categories

Categories

Maven Build Tools
GroupId

GroupId

io.paradoxical
ArtifactId

ArtifactId

resolved-pom-maven-plugin
Last Version

Last Version

1.0
Release Date

Release Date

Type

Type

maven-plugin
Description

Description

resolved-pom-maven-plugin Maven Plugin
A maven plugin to filter specific properties in a pom files and attach the resulting pom to the build output
Project URL

Project URL

https://github.com/paradoxical-io/resolved-pom-maven-plugin
Source Code Management

Source Code Management

http://github.com/paradoxical-io/resolved-pom-maven-plugin

Download resolved-pom-maven-plugin

How to add to project

<plugin>
    <groupId>io.paradoxical</groupId>
    <artifactId>resolved-pom-maven-plugin</artifactId>
    <version>1.0</version>
</plugin>

Dependencies

compile (3)

Group / Artifact Type Version
org.apache.maven.shared : maven-filtering jar 3.1.1
org.apache.maven : maven-plugin-api jar 2.0
org.codehaus.plexus : plexus-utils jar 3.0.8

provided (1)

Group / Artifact Type Version
org.apache.maven.plugin-tools : maven-plugin-annotations jar 3.2

test (1)

Group / Artifact Type Version
junit : junit jar 4.8.2

Project Modules

There are no modules declared in this project.

resolved-pom-maven-plugin

Build Status Maven Central

What

Install with

<plugin>
    <groupId>io.paradoxical</groupId>
    <artifactId>resolved-pom-maven-plugin</artifactId>
    <version>1.0</version>
    <configuration>
        <properties>
            <revision>${revision}</revision>
        </properties>
    </configuration>
    <executions>
        <execution>
            <id>resolve-my-pom</id>
            <phase>initialize</phase>
            <goals>
                <goal>resolve-pom</goal>
            </goals>
        </execution>
    </executions>
</plugin>

Why

If you ever wanted to auto version your artifacts, you may have found this article describing what appears to be a simple way of doing so.

The problem comes when you try it, ${revision} doesn't get replaced in the distributed pom files (the ones up on maven central.) This causes huge issues with maven transitive dependency resolution. There was a fix posted a while ago to address some of the problems However this solution doesn't address when you need to GPG sign your artifacts (like you do to relase to maven central.)

With this plugin, you can use the ${revision} style versioning and still easily deploy to maven central

Other plugins

After this project was built I found another plugin that does the basically same thing (and in some ways was better!)

The only difference is that it replaces every property in the pom with it's filtered versions where as this plugin uses a white-listed approach.

Maven Internals

I spent a good amount of time looking through maven plugins and internals to figure out the easiest way to trick maven into doing what I want :)

Here is some of the resources i used:

Internals

  • Filtering: Understanding what filtering is doing

Plugins

  • Resources: useful as a how to do filtering reference
  • Install: this is where poms are installed by default, also useful for the stupid lastModified check they do on files
  • Gpg:Sign: Useful to figure out what order signatures are added
  • Nexus:Deploy: If you want to understand that crazy that is the nexus deploy plugin

Misc

io.paradoxical

Paradoxical Devs

Libraries and dockerized applications. Pull requests welcome!

Versions

Version
1.0