mirror of https://github.com/apache/maven.git
MNG-5683: Expand session scope so that @SessionScoped components can be injected into lifecycle participants.
This commit is contained in:
parent
1ba9a6ffe0
commit
5fff038d71
|
@ -222,6 +222,14 @@ public class DefaultMaven
|
||||||
DefaultRepositorySystemSession repoSession = (DefaultRepositorySystemSession) newRepositorySession( request );
|
DefaultRepositorySystemSession repoSession = (DefaultRepositorySystemSession) newRepositorySession( request );
|
||||||
|
|
||||||
MavenSession session = new MavenSession( container, repoSession, request, result );
|
MavenSession session = new MavenSession( container, repoSession, request, result );
|
||||||
|
|
||||||
|
//
|
||||||
|
// We enter the session scope right after the MavenSession creation and before any of the AbstractLifecycleParticipant lookups
|
||||||
|
// so that @SessionScoped components can be @Injected into AbstractLifecycleParticipants.
|
||||||
|
//
|
||||||
|
sessionScope.enter();
|
||||||
|
sessionScope.seed( MavenSession.class, session );
|
||||||
|
|
||||||
legacySupport.setSession( session );
|
legacySupport.setSession( session );
|
||||||
|
|
||||||
try
|
try
|
||||||
|
@ -278,8 +286,6 @@ public class DefaultMaven
|
||||||
}
|
}
|
||||||
|
|
||||||
WorkspaceReader reactorWorkspace;
|
WorkspaceReader reactorWorkspace;
|
||||||
sessionScope.enter();
|
|
||||||
sessionScope.seed( MavenSession.class, session );
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
reactorWorkspace = container.lookup( WorkspaceReader.class, ReactorReader.HINT );
|
reactorWorkspace = container.lookup( WorkspaceReader.class, ReactorReader.HINT );
|
||||||
|
|
Loading…
Reference in New Issue