[MPH-220] Evaluating an expression for use in a script fails on Maven 4.0.0-rc-1
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 42/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- java
- Domain
- build-system
Research direction
Reproduce the issue using the provided POM and the help:evaluate entry point with Maven 3.9.9 and Maven 4.0.0-rc-1. Investigate why -q with -DforceStdout produces no output, and verify that the command returns 1.0.0-SNAPSHOT for the supplied expression.
Written by the indexing model from the issue text.
Description
Nils Breunese opened MPH-220 and commented
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:
mvn help:evaluate -Dexpression=project.version -q -DforceStdout
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:
<?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>
This returns 1.0.0-SNAPSHOT with Maven 3.9.9:
❯ mvn help:evaluate -Dexpression=project.version -q -DforceStdout
1.0.0-SNAPSHOT
But there is no output with Maven 4.0.0-rc-1:
❯ mvn help:evaluate -Dexpression=project.version -q -DforceStdout
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.
Affects: 3.5.1
- Dominant language
- Java
- Stars
- 29
- Forks
- 42
- Avg merge
- 23h 15m
- Merged PRs (30d)
- 6
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from apache/maven-help-plugin
-
bug
Difficulty 1/5 Under an hour Newbie friendliness 82/100
apache/maven-help-plugin#394 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
apache/maven-help-plugin#389 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
apache/maven-help-plugin#388 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
apache/maven-help-plugin#386 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
apache/maven-help-plugin#385 ·
All issues in apache/maven-help-plugin
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
infinispan/infinispan#18150 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
untriaged
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
opensearch-project/k-NN#3597 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100