[
https://issues.apache.org/jira/browse/MNG-7310?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17584694#comment-17584694
]
ASF GitHub Bot commented on MNG-7310:
-------------------------------------
michael-o commented on code in PR #639:
URL: https://github.com/apache/maven/pull/639#discussion_r954621955
##########
maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycles.java:
##########
@@ -139,13 +138,34 @@ public List<Lifecycle> getLifeCycles()
}
};
+ Map<String, Lifecycle> lifecyclesMap = lookupLifecycleMap();
+
// ensure canonical order of standard lifecycles
return lifecyclesMap.values().stream()
.peek( l -> Objects.requireNonNull( l.getId(),
"A lifecycle must have an id." ) )
.sorted( Comparator.comparing(
Lifecycle::getId, comparator ) )
.collect( Collectors.toList() );
}
+ private Map<String, Lifecycle> lookupLifecycleMap()
Review Comment:
lifecycles
##########
maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycles.java:
##########
@@ -139,13 +138,34 @@ public List<Lifecycle> getLifeCycles()
}
};
+ Map<String, Lifecycle> lifecyclesMap = lookupLifecycleMap();
+
// ensure canonical order of standard lifecycles
return lifecyclesMap.values().stream()
.peek( l -> Objects.requireNonNull( l.getId(),
"A lifecycle must have an id." ) )
.sorted( Comparator.comparing(
Lifecycle::getId, comparator ) )
.collect( Collectors.toList() );
}
+ private Map<String, Lifecycle> lookupLifecycleMap()
+ {
+ // This code is here to ensure maven-compat's EmptyLifecycleExecutor
keeps on working.
+ if ( plexusContainer == null )
Review Comment:
Add a TODO that this needs to go when compat is gone, no?
##########
maven-core/src/test/java/org/apache/maven/lifecycle/internal/LifecycleExecutionPlanCalculatorTest.java:
##########
@@ -63,6 +64,7 @@ public void testCalculateExecutionPlanWithGoalTasks()
// Maybe also make one with LifeCycleTasks
public static LifecycleExecutionPlanCalculator
createExecutionPlaceCalculator( MojoDescriptorCreator mojoDescriptorCreator )
+ throws ComponentLookupException
Review Comment:
Who throws this?
> Maven loads extension from another submodule
> --------------------------------------------
>
> Key: MNG-7310
> URL: https://issues.apache.org/jira/browse/MNG-7310
> Project: Maven
> Issue Type: Bug
> Affects Versions: 4.0.0-alpha-1
> Reporter: Martin Kanters
> Priority: Major
> Attachments: demo-plugins.zip
>
>
> With the latest Maven master, I'm not able to build a certain multi module
> project.
> It fails with the following error:
> C:\work\apache\demo>mvn validate
> [INFO] Scanning for projects...
> ...
> [ERROR] The build could not read 1 project -> [Help 1]
> [ERROR]
> [ERROR] The project com.example:demo2:0.0.1-SNAPSHOT
> (C:\work\apache\demo\demo2\pom.xml) has 1 error
> [ERROR] 'build.plugins.plugin.version' for
> org.springframework.cloud:spring-cloud-contract-maven-plugin must be a valid
> version but is '${project.version}'. @
> org.apache.maven:maven-core:4.0.0-alpha-1-SNAPSHOT:default-lifecycle-bindings
> The project looks as follows:
> parent
> – demo (module containing plugin "spring-cloud-contract-maven-plugin")
> – demo2 (module)
> "demo2" has no dependency on "demo" and the parent of "demo2" is "parent"..
> Somehow, the plugin from "demo" leaks into "demo2", which I've verified is
> the case during a debug session.
> I'm still unsure of a couple of things:
> - Does it only happen with the "spring-cloud-contract-maven-plugin" plugin?
> - Where does ${project.version} come from? (I've not defined it)
> I've done a bisect and tracked it down to the following commit:
> [[MNG-5577] Convert maven-core to JSR
> 330|https://github.com/apache/maven/commit/9567da2bc889a94f5c3b692b4afb310ddbacd6e5]
> Subject project is attached. Reproduce with the current master of Maven: mvn
> validate.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)