Git Product home page Git Product logo

resolve-parent-version-maven-plugin's Introduction

resolve-parent-version-maven-plugin

This plugin updates a pom file with the resolved parent version. That is, it ensures that for a pom that has a parent pom reference, that when it gets installed/deployed, any property placeholders in the parent pom version field will be resolved.

See this blog post for more details: https://blog.kiwitype.com/2017/maven-versioning-in-a-continuous-delivery-pipeline/

e.g. Say we have the following pom:

<project>
  <parent>
    <groupId>com.mycompany.app</groupId>
    <artifactId>my-app</artifactId>
    <version>1.${some.property}</version>
  </parent>
 
  <artifactId>my-module</artifactId>
 
  ...
 
</project>

If a build runs where some.property=999, then the installed/deployed pom will be:

<project>
  <parent>
    <groupId>com.mycompany.app</groupId>
    <artifactId>my-app</artifactId>
    <version>1.999</version>
  </parent>
 
  <artifactId>my-module</artifactId>
 
  ...
 
</project>

Usage

 <plugin>
  <groupId>com.hbakkum.maven.plugins</groupId>
  <artifactId>resolve-parent-version-maven-plugin</artifactId>
  <version>0.8</version>
  <executions>
    <execution>
      <goals>
        <goal>resolve-parent-version</goal>
      </goals>
    </execution>
  </executions>
</plugin>

resolve-parent-version-maven-plugin's People

Contributors

hbakkum avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

fardinbehboudi

resolve-parent-version-maven-plugin's Issues

Wrong snapshot version

All is running smoothly, so thanks again for your help in #1 :) !

There is still a minor issue. It seems that the metadata.xml stores a wrong timestamp when using SNAPSHOTS (the build number is ok). So there is a wrong file reference to "...134-499.pom" in metadata xml and there is only file ...133-499.pom.

See here for the background.

plugin does not resolve ${property} inside parent section for remote parent

Hi,

Im trying to solve the problem raised here - https://issues.apache.org/jira/browse/MNG-6746?filter=-2 but then stumbled across your plugin. I was trying your plugin out to see if it helps, but im still seeing Maven trying to download parent pom without resolving the version. I saw in your blog that this should work for remote parents too, so not sure what Im missing.

My setup -

Parent POM com.test.top is defined in a separate git repo (called top) and deployed with correct version (say 1.0.0-SNAPSHOT), available both in local and remote repositories.

My Project, Root POM (single module, for simplicity)

<parent>
  <groupId>com.test</groupId>
  <artifactId>top</artifactId>
  <version>${versprop}</version>
</parent>
<artifactId>my-project</artifactId>
<version>${revision}</version>
<packaging>jar</packaging>
<properties>
    <!-- Ideally do not want to define value here, but supply via mvn -D -->
    <versprop>1.0.0-SNAPSHOT</versprop>
</properties>
<build>
  <plugins>
      <plugin>
          <groupId>com.hbakkum.maven.plugins</groupId>
          <artifactId>resolve-parent-version-maven-plugin</artifactId>
          <version>0.8</version>
          <executions>
              <execution>
                  <goals>
                      <goal>resolve-parent-version</goal>
                  </goals>
              </execution>
          </executions>
      </plugin>
  </plugins>
 </build>

Executing command:

For mvn 3.6.1
mvn -Dversprop=1.0.0-SNAPSHOT -Drevision=1.0.0-SNAPSHOT clean install

And this gives the error:

Could not transfer artifact com.test:top:pom:${versprop} 
from/to nexus ($NEXUS_URL/content/groups/public): 
Failed to transfer file $NEXUS_URL/content/groups/public/com/test/top/$%7Bversprop%7D/top-$%7Bversprop%7D.pom with status code 400 and 'parent.relativePath' points at wrong local POM @ line 5, column 13 -> [Help 2]

All I just want is to resolve the parent's version tag, just like the issue what you had. I dont want to use relativePath, because that brings different set of issues.

I tried with mvn -X and do not see your plugin even being invoked. I tried with phase as validate/initialize too. So mvn tries to resolve the parent's property even before plugin invocations.

Any help appreciated.

Interferences with checkstyle plugin?

I really like that you already solved the problem we are facing :) - thanks a lot!

We migrated to this new release style (see commit here but when we add your plugin here the checkstyle plugin has a problem to find its config (which is also an xml):

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-checkstyle-plugin:2.17:check (default-cli) 
on project graphhopper-parent: 
Failed during checkstyle execution: Unable to find configuration file at location: 
checkstyle.xml: Could not find resource 'checkstyle.xml'. -> [Help 1]

You can reproduce this with:

mvn clean test verify checkstyle:check

When I look at your code this error does not make any sense but when I exclude your plugin again it builds fine.

Plugin not marked @threadSafe

Hello,

I just noticed that the plugin causes a lot of warnings when you run it on a (multimodule) project with parallel build. The error is like the one depicted here: hcoles/pitest#388 (comment)

Way to reproduce it:

  1. create any project with the resolve-parent-plugin
  2. run 'mvn clean install -T 2'

Not sure if there is any reason, why it is not marked as thread safe. Especially for large projects this is really helpful to build in parallel.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.