Patrick Barry created MNG-6848:
----------------------------------

             Summary: Ci Friendly builds broke with 3.6.2
                 Key: MNG-6848
                 URL: https://issues.apache.org/jira/browse/MNG-6848
             Project: Maven
          Issue Type: Bug
    Affects Versions: 3.6.2
            Reporter: Patrick Barry


We currently use ci friendly versions introduced in 3.5.0

[https://maven.apache.org/docs/3.5.0/release-notes.html] Using of CI friendly 
versions via ${revision}, ${sha1} and/or ${changelist} has been fixed MNG-6057, 
MNG-6090 and MNG-5895. It is very important to know if you are using the 
previously named properties for a version in your pom you have to use 
flatten-maven-plugin if you like to do an mvn install or mvn deploy more 
details can be found at Maven CI Friendly Versions.

 

Our parent pom are defined with the following version attributes:
{code:java}
<version>${version}${revision}</version>
<packaging>pom</packaging>
<groupId>com.group</groupId> 
<artifactId>my-proj</artifactId>
<properties>
   <version>0.0.1</version>
   <revision>-SNAPSHOT</revision>
</properties>
{code}
and then on our build machine, we mvn install -Drevision=<buildnumber>

our sub-modules inherit the version from parent like this:
{code:java}
<parent>
    <groupId>com.group</groupId>
    <artifactId>my-proj</artifactId>
    <!--suppress MavenPropertyInParent -->
    <version>${version}${revision}</version>
    <relativePath>..</relativePath>
</parent>
{code}
This allows us to only have to define the version in one spot and all 
sub-modules will stay in sync with parent.

This generated a warning but still worked until 3.6.2
{noformat}
15:56:14 [WARNING] Some problems were encountered while building the effective 
model for com.group:little-proj:jar:2.0.0.48015:56:14 [WARNING] 'version' 
contains an expression but should be a constant. @ 
com.group:my-proj:${version}${revision}, /var/build/workspace/project/pom.xml, 
line 17, column 14{noformat}
is now...
{noformat}
15:54:12 [ERROR] 'dependencies.dependency.version' for 
com.group:little-proj:jar is missing. @ 
com.group:test-proj:${version}${revision}, 
/var/build/workspace/test/./test-proj/pom.xml, line 89, column 22{noformat}
we use flatten plugin
{code:java}
<plugin>
  <groupId>org.codehaus.mojo</groupId>
  <artifactId>flatten-maven-plugin</artifactId>
  <version>1.1.0</version>
  <executions>
    <execution>
      <id>flatten</id>
      <phase>process-resources</phase>
      <goals>
        <goal>flatten</goal>
      </goals>
      <configuration>
        <updatePomFile>true</updatePomFile>
        <flattenMode>resolveCiFriendliesOnly</flattenMode>
      </configuration>
    </execution>
    <execution>
      <id>flatten.clean</id>
      <phase>clean</phase>
      <goals>
        <goal>clean</goal>
      </goals>
    </execution>
  </executions>
  <configuration>
    <updatePomFile>true</updatePomFile>
    <flattenMode>resolveCiFriendliesOnly</flattenMode>
  </configuration>
</plugin>{code}
If this is not the proper way to use Ci-Friendly versions, what is?

 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to