o Allow caller to specify per-request workspace reader for Maven execution

git-svn-id: https://svn.apache.org/repos/asf/maven/maven-3/trunk@992089 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Benjamin Bentmann 2010-09-02 19:55:29 +00:00
parent da8d45d550
commit e3796f6619
4 changed files with 28 additions and 1 deletions

View File

@ -353,7 +353,14 @@ public class DefaultMaven
LocalRepository localRepo = new LocalRepository( request.getLocalRepository().getBasedir() );
session.setLocalRepositoryManager( repoSystem.newLocalRepositoryManager( localRepo ) );
session.setWorkspaceReader( workspaceRepository );
if ( request.getWorkspaceReader() != null )
{
session.setWorkspaceReader( request.getWorkspaceReader() );
}
else
{
session.setWorkspaceReader( workspaceRepository );
}
DefaultSettingsDecryptionRequest decrypt = new DefaultSettingsDecryptionRequest();
decrypt.setProxies( request.getProxies() );

View File

@ -33,6 +33,7 @@ import org.apache.maven.settings.Mirror;
import org.apache.maven.settings.Proxy;
import org.apache.maven.settings.Server;
import org.sonatype.aether.RepositoryCache;
import org.sonatype.aether.repository.WorkspaceReader;
import org.sonatype.aether.transfer.TransferListener;
import org.sonatype.aether.util.DefaultRepositoryCache;
@ -45,6 +46,8 @@ public class DefaultMavenExecutionRequest
private RepositoryCache repositoryCache = new DefaultRepositoryCache();
private WorkspaceReader workspaceReader;
private ArtifactRepository localRepository;
private File localRepositoryPath;
@ -173,6 +176,7 @@ public class DefaultMavenExecutionRequest
copy.setRemoteRepositories( original.getRemoteRepositories() );
copy.setPluginArtifactRepositories( original.getPluginArtifactRepositories() );
copy.setRepositoryCache( original.getRepositoryCache() );
copy.setWorkspaceReader( original.getWorkspaceReader() );
copy.setNoSnapshotUpdates( original.isNoSnapshotUpdates() );
copy.setExecutionListener( original.getExecutionListener() );
return copy;
@ -1038,4 +1042,15 @@ public class DefaultMavenExecutionRequest
this.perCoreThreadCount = perCoreThreadCount;
}
public WorkspaceReader getWorkspaceReader()
{
return workspaceReader;
}
public MavenExecutionRequest setWorkspaceReader( WorkspaceReader workspaceReader )
{
this.workspaceReader = workspaceReader;
return this;
}
}

View File

@ -33,6 +33,7 @@ import org.apache.maven.settings.Proxy;
import org.apache.maven.settings.Server;
import org.codehaus.plexus.logging.Logger;
import org.sonatype.aether.RepositoryCache;
import org.sonatype.aether.repository.WorkspaceReader;
import org.sonatype.aether.transfer.TransferListener;
/**
@ -266,6 +267,9 @@ public interface MavenExecutionRequest
MavenExecutionRequest setRepositoryCache( RepositoryCache repositoryCache );
RepositoryCache getRepositoryCache();
WorkspaceReader getWorkspaceReader();
MavenExecutionRequest setWorkspaceReader( WorkspaceReader workspaceReader );
File getUserToolchainsFile();
MavenExecutionRequest setUserToolchainsFile( File userToolchainsFile );

View File

@ -36,6 +36,7 @@ import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
* Delegating local artifact repository chains the reactor, IDE workspace
* and user local repository.
*/
@Deprecated
public class DelegatingLocalArtifactRepository
extends MavenArtifactRepository
{