Skip to content

Profile-scoped properties not interpolated in repository URL in Maven 4 (rc5) #11920

@waterlx

Description

@waterlx

Affected version

4.0.0 RC5

Bug description

Spark parent pom defines the following profiles with properties:

<profile>
  <id>maven-mirror</id>
  <activation>
    <property><name>env.MAVEN_MIRROR_URL</name></property>
  </activation>
  <repositories>
    <repository>
      <id>maven-mirror</id>
      <url>${env.MAVEN_MIRROR_URL}</url>    <!-- here -->
    </repository>
  </repositories>
</profile>
...
<profile>
  <id>snapshots-and-staging</id>
  <properties>
    <!-- override point for ASF staging/snapshot repos -->
    <asf.staging>https://repository.apache.org/content/groups/staging/</asf.staging>
    <asf.snapshots>https://repository.apache.org/content/repositories/snapshots/</asf.snapshots>
  </properties>
  <pluginRepositories>
    <pluginRepository>
      <id>ASF Staging</id>
      <url>${asf.staging}</url>   <!-- here -->
    </pluginRepository>
    <pluginRepository>
      <id>ASF Snapshots</id>
      <url>${asf.snapshots}</url>   <!-- here -->
      <snapshots>
        <enabled>true</enabled>
      </snapshots>
      <releases>
        <enabled>false</enabled>
      </releases>
    </pluginRepository>
    ...
</profile>

Maven 4.0.0-rc-5 reports the following error which is not reproducible by Maven 3.x

[ERROR]   The project org.apache.spark:spark-parent_2.13:4.2.0-SNAPSHOT (/Users/water/Workspace/os/spark/pom.xml) has 4 errors
[ERROR]     'profiles.profile[maven-mirror].repositories.repository.[maven-mirror].url' contains an uninterpolated expression. @ line 3515, column 11
[ERROR]     'profiles.profile[snapshots-and-staging].pluginRepositories.pluginRepository.[ASF Staging].url' contains an uninterpolated expression. @ line 3555, column 11

It is easy to be reproduced by git clone the Spark repo then run mvn validate

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions