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

Falko Modler edited comment on MNG-6979 at 12/26/20, 12:11 AM:
---------------------------------------------------------------

[~michael-o] see [^MNG-6979.zip].
 - {{mvn clean install -f extension}}
 - {{cd example}}
 - {{mvn clean install}}

George and I expect {{parent}} to be the "current project" but instead it is:
{noformat}
[INFO] Scanning for projects...
[INFO] MavenProject: org.acme:child1:999-SNAPSHOT @ 
/home/foobar/proj/MNG-6979/example/child1/pom.xml
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] child1                                                             [jar]
[INFO] parent                                                             [pom]
[INFO] child2                                                             [jar]
{noformat}


was (Author: famod):
[~michael-o] see [^MNG-6979.zip].
- {{mvn clean install -f extensions}}
- {{cd example}}
- {{mvn clean install}}

George and I expect {{parent}} to be the "current project" but instead it is:
{noformat}
[INFO] Scanning for projects...
[INFO] MavenProject: org.acme:child1:999-SNAPSHOT @ 
/home/foobar/proj/MNG-6979/example/child1/pom.xml
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] child1                                                             [jar]
[INFO] parent                                                             [pom]
[INFO] child2                                                             [jar]
{noformat}

> MavenSession.getCurrentProject may return an incorrect project in a 
> multimodule build
> -------------------------------------------------------------------------------------
>
>                 Key: MNG-6979
>                 URL: https://issues.apache.org/jira/browse/MNG-6979
>             Project: Maven
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 3.6.3
>            Reporter: George Gastaldi
>            Priority: Major
>             Fix For: waiting-for-feedback
>
>         Attachments: MNG-6979.zip, project.zip
>
>
> Having an extension that just displays the current project, like in:
> {code:java}
> @Singleton
> @Named
> public class BuildModuleSelector extends AbstractMavenLifecycleParticipant {
>     @Inject
>     private Logger logger;
>     @Override
>     public void afterProjectsRead(MavenSession session) throws 
> MavenExecutionException {
>         logger.info(session.getCurrentProject().toString());
>         
> session.setProjects(Collections.singletonList(session.getCurrentProject()));
>     }
> }
> {code}
> Will fail to resolve the current project when executed in the root of a 
> project that depends on a module with the same parent.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to