maven-help-plugin icon indicating copy to clipboard operation
maven-help-plugin copied to clipboard

[MPH-182] mvn help:evaluate does not evaluate java.version correctly

Open jira-importer opened this issue 4 years ago • 2 comments

Matt smith opened MPH-182 and commented

Steps to reproduce:

  1. Create a Java project with Maven.
  2. Set a new property called java.version and set the value to a different value from your installed JDK.
  3. Run mvn help:evaluate and use the expression ${java.version}
  4. The Java version that will be output will be your JDK version, not the property value.

Ideal behaviour:

  • Value that is output is the value that is within the java.version property.

Workaround:

  • Set another property (e.g. something) to the value ${java.version}
  • Run mvn help:evaluate and use the expression ${something}
  • The correct property value will be output.

Attachments:

2 votes, 3 watchers

jira-importer avatar Oct 08 '21 09:10 jira-importer

Michael Osipov commented

I think this is rooted in the expression evaluator in Maven Core. It goes through a stacked design of sources: org.apache.maven.project.interpolation.AbstractStringBasedModelInterpolator.createValueSources(Model, File, ProjectBuilderConfiguration)

jira-importer avatar Oct 08 '21 12:10 jira-importer

Miroslav Zaťko commented

in my case, on ubuntu, plugin shows "complete" value of java internal property "java.version" like "17.0.8.1" resp. "11.0.20.1" resp. "1.8.0_382" not just "17" as on screenshot

jira-importer avatar Sep 25 '23 08:09 jira-importer