Nils Breunese created MPH-220:
---------------------------------
Summary: Evaluating an expression for use in a script fails on
Maven 4.0.0-rc-1
Key: MPH-220
URL: https://issues.apache.org/jira/browse/MPH-220
Project: Maven Help Plugin
Issue Type: Bug
Components: evaluate
Affects Versions: 3.5.1
Reporter: Nils Breunese
https://maven.apache.org/plugins/maven-help-plugin/evaluate-mojo.html shows
that to use the value of an expression in a script, you can use this:
{code}
mvn help:evaluate -Dexpression=project.version -q -DforceStdout
{code}
I use a variant of this in a project and it works fine with Maven 3.9.9, but
when I try it with Maven 4.0.0-rc-1, I no longer get the expected output.
Here is a small reproducer POM:
{code}
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>foo</artifactId>
<version>${revision}</version>
<packaging>pom</packaging>
<properties>
<revision>1.0.0-SNAPSHOT</revision>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-help-plugin</artifactId>
<version>3.5.1</version>
</plugin>
</plugins>
</build>
</project>
{code}
This returns {{1.0.0-SNAPSHOT}} with Maven 3.9.9:
{code}
❯ mvn help:evaluate -Dexpression=project.version -q -DforceStdout
1.0.0-SNAPSHOT
{code}
But there is no output with Maven 4.0.0-rc-1:
{code}
❯ mvn help:evaluate -Dexpression=project.version -q -DforceStdout
{code}
Note that when I omit the {{-q}} flag, then I do see the expected version in
the output, but that output is of course not usable in an automated script.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)