mirror of https://github.com/apache/maven.git
o Fixed project building helper to use repo cache
git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@803256 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
13709defd0
commit
91d459309f
|
@ -22,6 +22,8 @@ package org.apache.maven.project;
|
|||
import java.util.List;
|
||||
|
||||
import org.apache.maven.artifact.repository.ArtifactRepository;
|
||||
import org.apache.maven.artifact.repository.DefaultRepositoryRequest;
|
||||
import org.apache.maven.artifact.repository.RepositoryRequest;
|
||||
import org.apache.maven.artifact.resolver.ArtifactResolutionException;
|
||||
import org.apache.maven.model.Model;
|
||||
import org.apache.maven.model.building.AbstractModelBuildingListener;
|
||||
|
@ -132,9 +134,13 @@ class DefaultModelBuildingListener
|
|||
{
|
||||
try
|
||||
{
|
||||
projectRealm =
|
||||
projectBuildingHelper.createProjectRealm( model, projectBuildingRequest.getLocalRepository(),
|
||||
pluginRepositories );
|
||||
RepositoryRequest repositoryRequest = new DefaultRepositoryRequest();
|
||||
repositoryRequest.setCache( projectBuildingRequest.getRepositoryCache() );
|
||||
repositoryRequest.setLocalRepository( projectBuildingRequest.getLocalRepository() );
|
||||
repositoryRequest.setRemoteRepositories( pluginRepositories );
|
||||
repositoryRequest.setOffline( projectBuildingRequest.isOffline() );
|
||||
|
||||
projectRealm = projectBuildingHelper.createProjectRealm( model, repositoryRequest );
|
||||
}
|
||||
catch ( ArtifactResolutionException e )
|
||||
{
|
||||
|
|
|
@ -29,6 +29,7 @@ import org.apache.maven.ArtifactFilterManager;
|
|||
import org.apache.maven.artifact.Artifact;
|
||||
import org.apache.maven.artifact.InvalidRepositoryException;
|
||||
import org.apache.maven.artifact.repository.ArtifactRepository;
|
||||
import org.apache.maven.artifact.repository.RepositoryRequest;
|
||||
import org.apache.maven.artifact.resolver.ArtifactResolutionException;
|
||||
import org.apache.maven.artifact.resolver.ArtifactResolutionRequest;
|
||||
import org.apache.maven.artifact.resolver.ArtifactResolutionResult;
|
||||
|
@ -101,8 +102,7 @@ public class DefaultProjectBuildingHelper
|
|||
return artifactRepositories;
|
||||
}
|
||||
|
||||
public ClassRealm createProjectRealm( Model model, ArtifactRepository localRepository,
|
||||
List<ArtifactRepository> remoteRepositories )
|
||||
public ClassRealm createProjectRealm( Model model, RepositoryRequest repositoryRequest )
|
||||
throws ArtifactResolutionException
|
||||
{
|
||||
ClassRealm projectRealm = null;
|
||||
|
@ -137,7 +137,7 @@ public class DefaultProjectBuildingHelper
|
|||
repositorySystem.createArtifact( extension.getGroupId(), extension.getArtifactId(),
|
||||
extension.getVersion(), "jar" );
|
||||
|
||||
populateRealm( projectRealm, artifact, null, localRepository, remoteRepositories );
|
||||
populateRealm( projectRealm, artifact, null, repositoryRequest );
|
||||
}
|
||||
|
||||
for ( Plugin plugin : extensionPlugins )
|
||||
|
@ -150,7 +150,7 @@ public class DefaultProjectBuildingHelper
|
|||
dependencies.add( repositorySystem.createDependencyArtifact( dependency ) );
|
||||
}
|
||||
|
||||
populateRealm( projectRealm, artifact, dependencies, localRepository, remoteRepositories );
|
||||
populateRealm( projectRealm, artifact, dependencies, repositoryRequest );
|
||||
}
|
||||
|
||||
try
|
||||
|
@ -167,15 +167,13 @@ public class DefaultProjectBuildingHelper
|
|||
}
|
||||
|
||||
private void populateRealm( ClassRealm realm, Artifact artifact, Set<Artifact> dependencies,
|
||||
ArtifactRepository localRepository, List<ArtifactRepository> remoteRepositories )
|
||||
RepositoryRequest repositoryRequest )
|
||||
throws ArtifactResolutionException
|
||||
{
|
||||
ArtifactResolutionRequest request = new ArtifactResolutionRequest();
|
||||
ArtifactResolutionRequest request = new ArtifactResolutionRequest( repositoryRequest );
|
||||
request.setArtifact( artifact );
|
||||
request.setArtifactDependencies( dependencies );
|
||||
request.setResolveTransitively( true );
|
||||
request.setLocalRepository( localRepository );
|
||||
request.setRemoteRepositories( remoteRepositories );
|
||||
// FIXME setTransferListener
|
||||
|
||||
ArtifactResolutionResult result = repositorySystem.resolve( request );
|
||||
|
|
|
@ -23,6 +23,7 @@ import java.util.List;
|
|||
|
||||
import org.apache.maven.artifact.InvalidRepositoryException;
|
||||
import org.apache.maven.artifact.repository.ArtifactRepository;
|
||||
import org.apache.maven.artifact.repository.RepositoryRequest;
|
||||
import org.apache.maven.artifact.resolver.ArtifactResolutionException;
|
||||
import org.apache.maven.model.Model;
|
||||
import org.apache.maven.model.Repository;
|
||||
|
@ -55,13 +56,11 @@ public interface ProjectBuildingHelper
|
|||
* Creates the project realm that hosts the build extensions of the specified model.
|
||||
*
|
||||
* @param model The model to create the project realm for, must not be {@code null}
|
||||
* @param localRepository The local repository to use for artifact resolution, must not be {@code null}.
|
||||
* @param remoteRepositories The remote repositories to use for artifact resolution, must not be {@code null}.
|
||||
* @param repositoryRequest The repository request to use for artifact resolution, must not be {@code null}.
|
||||
* @return The project realm or {@code null} if the project uses no extensions.
|
||||
* @throws ArtifactResolutionException If any build extension could not be resolved.
|
||||
*/
|
||||
ClassRealm createProjectRealm( Model model, ArtifactRepository localRepository,
|
||||
List<ArtifactRepository> remoteRepositories )
|
||||
ClassRealm createProjectRealm( Model model, RepositoryRequest repositoryRequest )
|
||||
throws ArtifactResolutionException;
|
||||
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@ import java.util.List;
|
|||
|
||||
import org.apache.maven.artifact.InvalidRepositoryException;
|
||||
import org.apache.maven.artifact.repository.ArtifactRepository;
|
||||
import org.apache.maven.artifact.repository.RepositoryRequest;
|
||||
import org.apache.maven.artifact.resolver.ArtifactResolutionException;
|
||||
import org.apache.maven.model.Model;
|
||||
import org.apache.maven.model.Repository;
|
||||
|
@ -54,8 +55,7 @@ public class EmptyProjectBuildingHelper
|
|||
}
|
||||
}
|
||||
|
||||
public ClassRealm createProjectRealm( Model model, ArtifactRepository localRepository,
|
||||
List<ArtifactRepository> remoteRepositories )
|
||||
public ClassRealm createProjectRealm( Model model, RepositoryRequest repositoryRequest )
|
||||
throws ArtifactResolutionException
|
||||
{
|
||||
return null;
|
||||
|
|
Loading…
Reference in New Issue