[ 
https://issues.apache.org/jira/browse/MNG-8434?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17905927#comment-17905927
 ] 

Delany commented on MNG-8434:
-----------------------------

My parent project sets the build element 
{code:xml}
<finalName>${build.finalName}</finalName>
{code}
 and the property
{code:xml}
<build.finalName>${project.artifactId}-${project.version}</build.finalName>
{code}
So it looks like Maven is now using that property even though I got there first!

It would be good if Maven could reserve a pattern for properties so we can 
avoid a collision in future.

> Recursive variable reference
> ----------------------------
>
>                 Key: MNG-8434
>                 URL: https://issues.apache.org/jira/browse/MNG-8434
>             Project: Maven
>          Issue Type: Bug
>    Affects Versions: 4.0.0-rc-2
>            Reporter: Delany
>            Priority: Major
>
> With project wrapper/maven-wrapper.properties
> {code:java}
> wrapperVersion=3.3.2
> distributionType=only-script
> distributionUrl=https://repository.apache.org/content/repositories/maven-2256/org/apache/maven/apache-maven/4.0.0-rc-2/apache-maven-4.0.0-rc-2-bin.zip{code}
> a settings file profile
> {code:java}
> <profile>
>       <id>stage</id>
>       <activation>
>         <property>
>           <name>stage</name>
>         </property>
>       </activation>
>       <repositories>
>         <repository>
>           <id>staging</id>
>           <name>Maven Staging</name>
>           
> <url>https://repository.apache.org/content/repositories/maven-${stage}/</url>
>         </repository>
>       </repositories>
>       <pluginRepositories>
>         <pluginRepository>
>           <id>staging-plugin</id>
>           <name>Maven Staging</name>
>           
> <url>https://repository.apache.org/content/repositories/maven-${stage}/</url>
>         </pluginRepository>
>       </pluginRepositories>
>     </profile> {code}
> and command
> {code:java}
> ./mvnw -N clean -Dstage=2256 -e{code}
> I get this error
> {code:java}
> [ERROR] The build could not read 1 project -> [Help 1]
> org.apache.maven.project.ProjectBuildingException: Some problems were 
> encountered while processing the POMs
>     at 
> org.apache.maven.project.DefaultProjectBuilder$BuildSession.build(DefaultProjectBuilder.java:464)
>     at 
> org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:184)
>     at 
> org.apache.maven.project.collector.DefaultProjectsSelector.selectProjects(DefaultProjectsSelector.java:61)
>     at 
> org.apache.maven.project.collector.RequestPomCollectionStrategy.collectProjects(RequestPomCollectionStrategy.java:49)
>     at 
> org.apache.maven.graph.DefaultGraphBuilder.getProjectsForMavenReactor(DefaultGraphBuilder.java:364)
>     at 
> org.apache.maven.graph.DefaultGraphBuilder.build(DefaultGraphBuilder.java:100)
>     at org.apache.maven.DefaultMaven.buildGraph(DefaultMaven.java:629)
>     at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:250)
>     at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:225)
>     at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:149)
>     at 
> org.apache.maven.cling.invoker.mvn.MavenInvoker.doExecute(MavenInvoker.java:470)
>     at 
> org.apache.maven.cling.invoker.mvn.MavenInvoker.execute(MavenInvoker.java:95)
>     at 
> org.apache.maven.cling.invoker.mvn.MavenInvoker.execute(MavenInvoker.java:85)
>     at 
> org.apache.maven.cling.invoker.LookupInvoker.doInvoke(LookupInvoker.java:145)
>     at 
> org.apache.maven.cling.invoker.LookupInvoker.invoke(LookupInvoker.java:116)
>     at org.apache.maven.cling.ClingSupport.run(ClingSupport.java:64)
>     at org.apache.maven.cling.MavenCling.main(MavenCling.java:51)
>     at 
> jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
>     at java.lang.reflect.Method.invoke(Method.java:580)
>     at 
> org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:255)
>     at 
> org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:201)
>     at 
> org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:361)
>     at 
> org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:314)
> [ERROR]   
> [ERROR]   The project com.rushmore:rushmore-parent:2.4.1-SNAPSHOT 
> (/git/rushmore/pom.xml) has 1 error
> [ERROR]     recursive variable reference: build.finalName
> org.apache.maven.api.services.InterpolatorException: recursive variable 
> reference: build.finalName
>     at 
> org.apache.maven.internal.impl.model.DefaultInterpolator.resolveVariable(DefaultInterpolator.java:374)
>     at 
> org.apache.maven.internal.impl.model.DefaultInterpolator.processSubstitution(DefaultInterpolator.java:312)
>     at 
> org.apache.maven.internal.impl.model.DefaultInterpolator.doSubstVars(DefaultInterpolator.java:271)
>     at 
> org.apache.maven.internal.impl.model.DefaultInterpolator.resolveVariable(DefaultInterpolator.java:385)
>     at 
> org.apache.maven.internal.impl.model.DefaultInterpolator.processSubstitution(DefaultInterpolator.java:312)
>     at 
> org.apache.maven.internal.impl.model.DefaultInterpolator.doSubstVars(DefaultInterpolator.java:271)
>     at 
> org.apache.maven.internal.impl.model.DefaultInterpolator.substVars(DefaultInterpolator.java:206)
>     at 
> org.apache.maven.internal.impl.model.DefaultInterpolator.interpolate(DefaultInterpolator.java:86)
>     at 
> org.apache.maven.internal.impl.model.DefaultInterpolator.interpolate(DefaultInterpolator.java:75)
>     at 
> org.apache.maven.internal.impl.model.DefaultModelInterpolator.lambda$createInterpolator$3(DefaultModelInterpolator.java:117)
>     at 
> org.apache.maven.model.v4.MavenTransformer.transform(MavenTransformer.java:93)
>     at 
> org.apache.maven.model.v4.MavenTransformer.transformBuildBase_FinalName(MavenTransformer.java:467)
>     at 
> org.apache.maven.model.v4.MavenTransformer.transformBuild(MavenTransformer.java:502)
>     at 
> org.apache.maven.model.v4.MavenTransformer.transformModel_Build(MavenTransformer.java:300)
>     at 
> org.apache.maven.model.v4.MavenTransformer.transformModel(MavenTransformer.java:132)
>     at 
> org.apache.maven.model.v4.MavenTransformer.visit(MavenTransformer.java:86)
>     at 
> org.apache.maven.internal.impl.model.DefaultModelInterpolator.interpolateModel(DefaultModelInterpolator.java:104)
>     at 
> org.apache.maven.internal.impl.model.DefaultModelBuilder.interpolateModel(DefaultModelBuilder.java:1911)
>     at 
> org.apache.maven.internal.impl.model.DefaultModelBuilder$ModelBuilderSessionState.readEffectiveModel(DefaultModelBuilder.java:1218)
>     at 
> org.apache.maven.internal.impl.model.DefaultModelBuilder$ModelBuilderSessionState.buildEffectiveModel(DefaultModelBuilder.java:810)
>     at 
> org.apache.maven.internal.impl.model.DefaultModelBuilder$ModelBuilderSessionState.lambda$buildBuildPom$7(DefaultModelBuilder.java:678)
>     at 
> org.apache.maven.internal.impl.util.PhasingExecutor.lambda$execute$0(PhasingExecutor.java:80)
>     at 
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
>     at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
>     at java.lang.Thread.run(Thread.java:1583){code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to