From e3796f66193abaee06c4d59c12c1382ef8c8d392 Mon Sep 17 00:00:00 2001 From: Benjamin Bentmann Date: Thu, 2 Sep 2010 19:55:29 +0000 Subject: [PATCH] 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 --- .../main/java/org/apache/maven/DefaultMaven.java | 9 ++++++++- .../execution/DefaultMavenExecutionRequest.java | 15 +++++++++++++++ .../maven/execution/MavenExecutionRequest.java | 4 ++++ .../DelegatingLocalArtifactRepository.java | 1 + 4 files changed, 28 insertions(+), 1 deletion(-) diff --git a/maven-core/src/main/java/org/apache/maven/DefaultMaven.java b/maven-core/src/main/java/org/apache/maven/DefaultMaven.java index cf7d732389..311678790c 100644 --- a/maven-core/src/main/java/org/apache/maven/DefaultMaven.java +++ b/maven-core/src/main/java/org/apache/maven/DefaultMaven.java @@ -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() ); diff --git a/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequest.java b/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequest.java index 96ec958b4d..1ac290dbb6 100644 --- a/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequest.java +++ b/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequest.java @@ -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; + } + } diff --git a/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java b/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java index 85614210fe..c66cd3ad85 100644 --- a/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java +++ b/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java @@ -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 ); diff --git a/maven-core/src/main/java/org/apache/maven/repository/DelegatingLocalArtifactRepository.java b/maven-core/src/main/java/org/apache/maven/repository/DelegatingLocalArtifactRepository.java index 1bc5193b67..491d575eb7 100644 --- a/maven-core/src/main/java/org/apache/maven/repository/DelegatingLocalArtifactRepository.java +++ b/maven-core/src/main/java/org/apache/maven/repository/DelegatingLocalArtifactRepository.java @@ -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 {