A maven plugin to include your resolved/filtered pom file in install/deploy phases
Java Groovy
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.deployment @ e541e9e
src
.gitignore
.gitmodules
.travis.yml
README.md
pom.xml

README.md

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