apache / apache/maven-help-plugin

[MPH-220] Evaluating an expression for use in a script fails on Maven 4.0.0-rc-1

Open
#173 5 comments 0 reactions 0 assignees View on GitHub
bug priority:major
Dominant language
Java
Stars
29
Forks
42
Avg merge
1d 12h
Merged PRs (30d)
6

Description

**[Nils Breunese](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=breun)** opened **[MPH-220](https://issues.apache.org/jira/browse/MPH-220?redirect=false)** 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:

```

4.0.0

com.example
foo
${revision}
pom


1.0.0-SNAPSHOT




org.apache.maven.plugins
maven-help-plugin
3.5.1


```

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

Contributor guide

No contributing guide indexed for this repository

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.

Assessment

Tech stack
java
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.