Francisco Bento da Silva Neto created MNG-7887:
--------------------------------------------------

             Summary: cannot inject ci-friendly revision/sha1/changelist 
properties via MAVEN_OPTS
                 Key: MNG-7887
                 URL: https://issues.apache.org/jira/browse/MNG-7887
             Project: Maven
          Issue Type: Bug
    Affects Versions: 3.9.4, 3.9.3, 3.9.2, 3.9.1, 3.9.0
            Reporter: Francisco Bento da Silva Neto


h1. Intro

Prior to 3.9.x, it was possible to inject the 
[ci-friendly|https://maven.apache.org/maven-ci-friendly.html] 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.
h1. Reproducing

Given the {_}pom.xml{_}:

 
{noformat}
<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>{noformat}
If I run:
{noformat}
MAVEN_OPTS='-Drevision=optsValue -Drevision2=optsValue2' mvn help:effective-pom 
| grep revision{noformat}
On *3.8.9-* I get:
{noformat}
    <revision>optsValue</revision>
    <revision2>pomValue</revision2>
                <echo>echoing revision optsValue revision2 
pomValue</echo>{noformat}
On *3.9.0+* I get:
{code:java}
    <revision>pomValue</revision>
    <revision2>pomValue</revision2>
                <echo>echoing revision optsValue revision2 pomValue</echo> 
{code}
 



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to