mirror of https://github.com/apache/maven.git
[MNG-5185] [MNG-5181]
add cli flag to be able to remove use of EnhancedLocalRepositoryManager.
This commit is contained in:
parent
6c3ec90f2c
commit
27f8b0f81a
|
@ -85,8 +85,10 @@ import org.sonatype.aether.RepositorySystem;
|
|||
import org.sonatype.aether.RepositorySystemSession;
|
||||
import org.sonatype.aether.repository.Authentication;
|
||||
import org.sonatype.aether.repository.LocalRepository;
|
||||
import org.sonatype.aether.repository.NoLocalRepositoryManagerException;
|
||||
import org.sonatype.aether.repository.RepositoryPolicy;
|
||||
import org.sonatype.aether.repository.WorkspaceReader;
|
||||
import org.sonatype.aether.spi.localrepo.LocalRepositoryManagerFactory;
|
||||
import org.sonatype.aether.util.DefaultRepositorySystemSession;
|
||||
import org.sonatype.aether.util.repository.ChainedWorkspaceReader;
|
||||
import org.sonatype.aether.util.repository.DefaultAuthenticationSelector;
|
||||
|
@ -128,6 +130,9 @@ public class DefaultMaven
|
|||
@Requirement
|
||||
private RepositorySystem repoSystem;
|
||||
|
||||
@Requirement (optional = true, hint = "simple")
|
||||
private LocalRepositoryManagerFactory simpleLocalRepositoryManagerFactory;
|
||||
|
||||
@Requirement
|
||||
private SettingsDecrypter settingsDecrypter;
|
||||
|
||||
|
@ -352,7 +357,23 @@ public class DefaultMaven
|
|||
session.setArtifactTypeRegistry( RepositoryUtils.newArtifactTypeRegistry( artifactHandlerManager ) );
|
||||
|
||||
LocalRepository localRepo = new LocalRepository( request.getLocalRepository().getBasedir() );
|
||||
|
||||
if (request.isUseSimpleLocalRepostoryManager())
|
||||
{
|
||||
try
|
||||
{
|
||||
session.setLocalRepositoryManager( simpleLocalRepositoryManagerFactory.newInstance( localRepo ) );
|
||||
}
|
||||
catch ( NoLocalRepositoryManagerException e )
|
||||
{
|
||||
|
||||
logger.warn( "fail to configure simple local repository manager back to default" );
|
||||
session.setLocalRepositoryManager( repoSystem.newLocalRepositoryManager( localRepo ) );
|
||||
}
|
||||
}
|
||||
else {
|
||||
session.setLocalRepositoryManager( repoSystem.newLocalRepositoryManager( localRepo ) );
|
||||
}
|
||||
|
||||
if ( request.getWorkspaceReader() != null )
|
||||
{
|
||||
|
|
|
@ -143,6 +143,8 @@ public class DefaultMavenExecutionRequest
|
|||
*/
|
||||
private boolean noSnapshotUpdates;
|
||||
|
||||
private boolean useSimpleLocalRepostoryManager = false;
|
||||
|
||||
public DefaultMavenExecutionRequest()
|
||||
{
|
||||
}
|
||||
|
@ -1076,4 +1078,14 @@ public class DefaultMavenExecutionRequest
|
|||
return this;
|
||||
}
|
||||
|
||||
public boolean isUseSimpleLocalRepostoryManager()
|
||||
{
|
||||
return this.useSimpleLocalRepostoryManager;
|
||||
}
|
||||
|
||||
public MavenExecutionRequest setUseSimpleLocalRepostoryManager( boolean useSimpleLocalRepostoryManager )
|
||||
{
|
||||
this.useSimpleLocalRepostoryManager = useSimpleLocalRepostoryManager;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -283,4 +283,14 @@ public interface MavenExecutionRequest
|
|||
|
||||
ProjectBuildingRequest getProjectBuildingRequest();
|
||||
|
||||
/**
|
||||
* @since 3.1
|
||||
*/
|
||||
boolean isUseSimpleLocalRepostoryManager();
|
||||
|
||||
/**
|
||||
* @since 3.1
|
||||
*/
|
||||
MavenExecutionRequest setUseSimpleLocalRepostoryManager(boolean useSimpleLocalRepostoryManager);
|
||||
|
||||
}
|
||||
|
|
|
@ -97,6 +97,8 @@ public class CLIManager
|
|||
|
||||
public static final String THREADS = "T";
|
||||
|
||||
public static final String SIMPLE_LOCAL_REPOSITORY_MANAGER ="slrm";
|
||||
|
||||
protected Options options;
|
||||
|
||||
@SuppressWarnings( "static-access" )
|
||||
|
@ -134,6 +136,7 @@ public class CLIManager
|
|||
options.addOption( OptionBuilder.withLongOpt( "encrypt-password" ).hasArg().withDescription( "Encrypt server password" ).create( ENCRYPT_PASSWORD ) );
|
||||
options.addOption( OptionBuilder.withLongOpt( "threads" ).hasArg().withDescription( "Thread count, for instance 2.0C where C is core multiplied" ).create( THREADS ) );
|
||||
|
||||
options.addOption( OptionBuilder.withLongOpt( "simple-local-repository-manager" ).withDescription( "Use a simple local Repository Manager (no use of _maven.repositories)" ).create( SIMPLE_LOCAL_REPOSITORY_MANAGER ) );
|
||||
// Adding this back in for compatibility with the verifier that hard codes this option.
|
||||
|
||||
options.addOption( OptionBuilder.withLongOpt( "no-plugin-registry" ).withDescription( "Ineffective, only kept for backward compatibility" ).create( "npr" ) );
|
||||
|
|
|
@ -210,6 +210,7 @@ public class MavenCli
|
|||
settings( cliRequest );
|
||||
populateRequest( cliRequest );
|
||||
encryption( cliRequest );
|
||||
repository( cliRequest );
|
||||
return execute( cliRequest );
|
||||
}
|
||||
catch ( ExitException e )
|
||||
|
@ -538,6 +539,15 @@ public class MavenCli
|
|||
}
|
||||
}
|
||||
|
||||
private void repository( CliRequest cliRequest )
|
||||
throws Exception
|
||||
{
|
||||
if ( cliRequest.commandLine.hasOption( CLIManager.SIMPLE_LOCAL_REPOSITORY_MANAGER ) )
|
||||
{
|
||||
cliRequest.request.setUseSimpleLocalRepostoryManager( true );
|
||||
}
|
||||
}
|
||||
|
||||
private int execute( CliRequest cliRequest )
|
||||
{
|
||||
eventSpyDispatcher.onEvent( cliRequest.request );
|
||||
|
|
Loading…
Reference in New Issue