Jack Green created MNG-8709:
-------------------------------
Summary: Maven 4.0 erroneously reports it cannot resolve a
dependency version from a property
Key: MNG-8709
URL: https://issues.apache.org/jira/browse/MNG-8709
Project: Maven
Issue Type: Bug
Affects Versions: 4.0.0-rc-3
Reporter: Jack Green
Attachments: pom.xml
Take a {{pom.xml}} where the version of a dependency is set via a property
within a profile:
{code:java}
<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.me</groupId>
<artifactId>maven-4-test</artifactId> <version>0.0.1-SNAPSHOT</version>
<profiles> <profile> <id>spring-6</id>
<activation> <activeByDefault>true</activeByDefault>
</activation> <properties>
<org.springframework.version>6.2.0</org.springframework.version>
</properties> </profile> </profiles> <dependencies>
<dependency> <groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${org.springframework.version}</version>
<scope>test</scope> </dependency> </dependencies></project>
{code}
This works fine in {{{}Maven 3.9.9
(8e8579a9e76f7d015ee5ec7bfcdc97d260186937){}}}, but in {{{}Maven 4.0.0-rc-3
(3952d00ce65df6753b63a51e86b1f626c55a8df2){}}}, {{clean install}} fails with:
{code:java}
[ERROR] Failed to execute goal
org.apache.maven.plugins:maven-install-plugin:3.1.3:install (default-install)
on project maven-4-test: Execution default-install of goal
org.apache.maven.plugins:maven-install-plugin:3.1.3:install failed:
org.apache.maven.api.services.ModelBuilderException: 1 problem was for
com.me:maven-4-test:jar:0.0.1-SNAPSHOT
[ERROR] - [ERROR] 'dependencies.dependency.version' for
org.springframework:spring-context:jar must be a valid version but is
'${org.springframework.version}'. @ line 24, column 13{code}
I believe this to be a bug because if you query other ways it shows the version
_is_ being resolved:
{{{}help:evaluate -Dexpression=org.springframework.version{}}}:
{code:java}
6.2.0 {code}
help:effective-pom:
{code:java}
<properties>
{...}
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>6.2.0</version>
<scope>test</scope>
</dependency>
</dependencies> {code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)