Uploaded image for project: 'Maven'
  1. Maven
  2. MNG-7887

cannot inject ci-friendly revision/sha1/changelist properties via MAVEN_OPTS

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Information Provided
    • 3.9.0, 3.9.1, 3.9.2, 3.9.3, 3.9.4
    • None
    • None
    • None

    Description

      Intro

      Prior to 3.9.x, it was possible to inject the ci-friendly properties via MAVEN_OPTS.

      After 3.9.x it is possible only via command-line args or MAVEN_ARGS env.

      Curiously, setting user properties other than the ci-friendly specific properties via MAVEN_OPTS never worked, even on 3.8.x.

      Reproducing

      Given the pom.xml:

      <project>
        <modelVersion>4.0.0</modelVersion>
        <groupId>com.acme</groupId>
        <artifactId>property-bug</artifactId>
        <version>1.0.0</version>
        <packaging>pom</packaging>
        <properties>
          <revision>pomValue</revision>
          <revision2>pomValue</revision2>
        </properties>
        <build>
          <plugins>
            <plugin>
              <artifactId>maven-antrun-plugin</artifactId>
              <executions>
                <execution>
                  <phase>generate-resources</phase>
                  <goals>
                    <goal>run</goal>
                  </goals>
                  <configuration>
                    <tasks>
                      <echo>echoing revision ${revision} revision2 ${revision2}</echo>
                    </tasks>
                  </configuration>
                </execution>
              </executions>
            </plugin>
          </plugins>
        </build>
      </project>

      If I run:

      MAVEN_OPTS='-Drevision=optsValue -Drevision2=optsValue2' mvn help:effective-pom | grep revision

      On 3.8.9- I get:

          <revision>optsValue</revision>
          <revision2>pomValue</revision2>
                      <echo>echoing revision optsValue revision2 pomValue</echo>

      On 3.9.0+ I get:

          <revision>pomValue</revision>
          <revision2>pomValue</revision2>
                      <echo>echoing revision optsValue revision2 pomValue</echo> 

       

      Attachments

        Issue Links

          Activity

            People

              cstamas Tamas Cservenak
              chicobento@gmail.com Francisco Bento da Silva Neto
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: