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

Robert Scholte commented on MNG-7067:
-------------------------------------

I understand the need and yes, I agree it must be possible to inject 
dependencies one way or another.

We should pick this up once other issues have been solved, but let me share my 
concerns (in case I would forget them)
- AFAIK the afterProjectsRead is called after the buildplan is ready. I hope 
that with Maven 5 the model will be immutable at that point.
- Instead there must be a way to participate while constructing the buildplan, 
but still it should not be allowed to directly adjust the model as done above. 

> Ensure produced (consumable) pom takes into account extensions
> --------------------------------------------------------------
>
>                 Key: MNG-7067
>                 URL: https://issues.apache.org/jira/browse/MNG-7067
>             Project: Maven
>          Issue Type: Task
>    Affects Versions: 4.0.0-alpha-1
>            Reporter: Romain Manni-Bucau
>            Priority: Major
>
> Goal is to have this kind of (build time) extension reflected in the produced 
> pom:
> {code:java}
> @Component(role = AbstractMavenLifecycleParticipant.class, hint = 
> "rmannibucau-test")
> public class MyListener extends AbstractMavenLifecycleParticipant {
>     @Override
>     public void afterProjectsRead(final MavenSession session) throws 
> MavenExecutionException {
>         if (session.getCurrentProject() == null) {
>             return;
>         }
>         session.getProjects().forEach(p -> {
>             final Dependency dependency = new Dependency();
>             dependency.setGroupId("junit");
>             dependency.setArtifactId("junit");
>             dependency.setVersion("3.8.1");
>             p.getDependencies().add(dependency);
>         });
>     }
> } {code}
> Without having junit 3.8 in the project pom it should be in the installed pom.



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

Reply via email to