mirror of https://github.com/apache/maven.git
[MNG-7600] LocalRepositoryManager is created too early
LocalRepositoryManager needs configurations from RepositorySystemSession
so must be created after session configuration is finished.
(cherry picked from commit b1c1f7556d
)
This commit is contained in:
parent
b8b41c6d40
commit
474a470aa9
|
@ -158,28 +158,6 @@ public class DefaultRepositorySystemSessionFactory
|
|||
|
||||
session.setArtifactTypeRegistry( RepositoryUtils.newArtifactTypeRegistry( artifactHandlerManager ) );
|
||||
|
||||
LocalRepository localRepo = new LocalRepository( request.getLocalRepository().getBasedir() );
|
||||
|
||||
if ( request.isUseLegacyLocalRepository() )
|
||||
{
|
||||
try
|
||||
{
|
||||
session.setLocalRepositoryManager( simpleLocalRepoMgrFactory.newInstance( session, localRepo ) );
|
||||
logger.info( "Disabling enhanced local repository: using legacy is strongly discouraged to ensure"
|
||||
+ " build reproducibility." );
|
||||
|
||||
}
|
||||
catch ( NoLocalRepositoryManagerException e )
|
||||
{
|
||||
logger.error( "Failed to configure legacy local repository: falling back to default" );
|
||||
session.setLocalRepositoryManager( repoSystem.newLocalRepositoryManager( session, localRepo ) );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
session.setLocalRepositoryManager( repoSystem.newLocalRepositoryManager( session, localRepo ) );
|
||||
}
|
||||
|
||||
if ( request.getWorkspaceReader() != null )
|
||||
{
|
||||
session.setWorkspaceReader( request.getWorkspaceReader() );
|
||||
|
@ -305,9 +283,35 @@ public class DefaultRepositorySystemSessionFactory
|
|||
mavenRepositorySystem.injectProxy( session, request.getPluginArtifactRepositories() );
|
||||
mavenRepositorySystem.injectAuthentication( session, request.getPluginArtifactRepositories() );
|
||||
|
||||
setUpLocalRepositoryManager( request, session );
|
||||
|
||||
return session;
|
||||
}
|
||||
|
||||
private void setUpLocalRepositoryManager( MavenExecutionRequest request, DefaultRepositorySystemSession session )
|
||||
{
|
||||
LocalRepository localRepo = new LocalRepository( request.getLocalRepository().getBasedir() );
|
||||
|
||||
if ( request.isUseLegacyLocalRepository() )
|
||||
{
|
||||
try
|
||||
{
|
||||
session.setLocalRepositoryManager( simpleLocalRepoMgrFactory.newInstance( session, localRepo ) );
|
||||
logger.info( "Disabling enhanced local repository: using legacy is strongly discouraged to ensure"
|
||||
+ " build reproducibility." );
|
||||
}
|
||||
catch ( NoLocalRepositoryManagerException e )
|
||||
{
|
||||
logger.error( "Failed to configure legacy local repository: falling back to default" );
|
||||
session.setLocalRepositoryManager( repoSystem.newLocalRepositoryManager( session, localRepo ) );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
session.setLocalRepositoryManager( repoSystem.newLocalRepositoryManager( session, localRepo ) );
|
||||
}
|
||||
}
|
||||
|
||||
private Map<?, ?> getPropertiesFromRequestedProfiles( MavenExecutionRequest request )
|
||||
{
|
||||
|
||||
|
|
Loading…
Reference in New Issue