mirror of https://github.com/apache/maven.git
o trim out buildArtifactRepositories( Model )
git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@747639 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
df4430644b
commit
2862516673
|
@ -309,7 +309,16 @@ public class DefaultArtifactResolver
|
|||
|
||||
ArtifactResolutionResult result;
|
||||
|
||||
result = artifactCollector.collect( artifacts, originatingArtifact, managedVersions, localRepository, remoteRepositories, source, filter, listeners, conflictResolvers );
|
||||
result = artifactCollector.collect(
|
||||
artifacts,
|
||||
originatingArtifact,
|
||||
managedVersions,
|
||||
localRepository,
|
||||
remoteRepositories,
|
||||
source,
|
||||
filter,
|
||||
listeners,
|
||||
conflictResolvers );
|
||||
|
||||
// We have collected all the problems so let's mimic the way the old code worked and just blow up right here.
|
||||
// That's right lets just let it rip right here and send a big incomprehensible blob of text at unsuspecting
|
||||
|
@ -391,9 +400,15 @@ public class DefaultArtifactResolver
|
|||
// This is an attempt to get the metadata for the artifacts we are ultimately trying to resolve.
|
||||
// We still
|
||||
|
||||
ArtifactResolutionResult result = artifactCollector.collect( artifacts, originatingArtifact,
|
||||
managedVersions, localRepository,
|
||||
remoteRepositories, source, filter, listeners );
|
||||
ArtifactResolutionResult result = artifactCollector.collect(
|
||||
artifacts,
|
||||
originatingArtifact,
|
||||
managedVersions,
|
||||
localRepository,
|
||||
remoteRepositories,
|
||||
source,
|
||||
filter,
|
||||
listeners );
|
||||
|
||||
// Let's grab all the repositories that were gleaned. This we should know up front. I'm not sure
|
||||
// what the metadata source is doing. Repositories in POMs are deadly.
|
||||
|
|
|
@ -105,30 +105,35 @@ public class DefaultMavenProjectBuilder
|
|||
public MavenProject build( File projectDescriptor, ProjectBuilderConfiguration config )
|
||||
throws ProjectBuildingException
|
||||
{
|
||||
if(projectDescriptor == null)
|
||||
if ( projectDescriptor == null )
|
||||
{
|
||||
throw new IllegalArgumentException("projectDescriptor: null");
|
||||
throw new IllegalArgumentException( "projectDescriptor: null" );
|
||||
}
|
||||
|
||||
if(config == null)
|
||||
if ( config == null )
|
||||
{
|
||||
throw new IllegalArgumentException("config: null");
|
||||
throw new IllegalArgumentException( "config: null" );
|
||||
}
|
||||
|
||||
List<ArtifactRepository> artifactRepositories = new ArrayList<ArtifactRepository>();
|
||||
try
|
||||
{
|
||||
artifactRepositories.addAll( repositorySystem.buildArtifactRepositories( projectBuilder.getSuperModel().getRepositories() ) );
|
||||
}
|
||||
catch ( InvalidRepositoryException e )
|
||||
{
|
||||
throw new ProjectBuildingException( "Cannot create repositories from super model.", e.getMessage() );
|
||||
}
|
||||
|
||||
List<ArtifactRepository> artifactRepositories = new ArrayList<ArtifactRepository>( );
|
||||
artifactRepositories.addAll( repositorySystem.buildArtifactRepositories( projectBuilder.getSuperModel() ) );
|
||||
if(config.getRemoteRepositories() != null)
|
||||
{
|
||||
artifactRepositories.addAll(config.getRemoteRepositories());
|
||||
}
|
||||
|
||||
MavenProject project = readModelFromLocalPath( "unknown",
|
||||
projectDescriptor,
|
||||
new DefaultPomArtifactResolver( config.getLocalRepository(),
|
||||
artifactRepositories, repositorySystem ), config );
|
||||
if ( config.getRemoteRepositories() != null )
|
||||
{
|
||||
artifactRepositories.addAll( config.getRemoteRepositories() );
|
||||
}
|
||||
|
||||
MavenProject project = readModelFromLocalPath( "unknown", projectDescriptor, new DefaultPomArtifactResolver( config.getLocalRepository(), artifactRepositories, repositorySystem ), config );
|
||||
|
||||
project.setFile( projectDescriptor );
|
||||
|
||||
|
||||
project = buildWithProfiles( project.getModel(), config, projectDescriptor, project.getParentFile(), true );
|
||||
|
||||
Build build = project.getBuild();
|
||||
|
@ -176,9 +181,17 @@ public class DefaultMavenProjectBuilder
|
|||
if ( project != null )
|
||||
{
|
||||
return project;
|
||||
}
|
||||
}
|
||||
|
||||
List<ArtifactRepository> artifactRepositories = new ArrayList<ArtifactRepository>( remoteArtifactRepositories );
|
||||
artifactRepositories.addAll( repositorySystem.buildArtifactRepositories( projectBuilder.getSuperModel() ) );
|
||||
try
|
||||
{
|
||||
artifactRepositories.addAll( repositorySystem.buildArtifactRepositories( projectBuilder.getSuperModel().getRepositories() ) );
|
||||
}
|
||||
catch ( InvalidRepositoryException e )
|
||||
{
|
||||
throw new ProjectBuildingException( "Cannot create repositories from super model.", e.getMessage() );
|
||||
}
|
||||
|
||||
File f = (artifact.getFile() != null) ? artifact.getFile() : new File( localRepository.getBasedir(), localRepository.pathOf( artifact ) );
|
||||
repositorySystem.findModelFromRepository( artifact, artifactRepositories, localRepository );
|
||||
|
|
|
@ -394,21 +394,6 @@ public class LegacyMavenRepositorySystem
|
|||
}
|
||||
}
|
||||
|
||||
public List<ArtifactRepository> buildArtifactRepositories( Model model )
|
||||
throws ProjectBuildingException
|
||||
{
|
||||
try
|
||||
{
|
||||
return buildArtifactRepositories( model.getRepositories() );
|
||||
}
|
||||
catch ( InvalidRepositoryException e )
|
||||
{
|
||||
String projectId = safeVersionlessKey( model.getGroupId(), model.getArtifactId() );
|
||||
|
||||
throw new ProjectBuildingException( projectId, e.getMessage(), e );
|
||||
}
|
||||
}
|
||||
|
||||
private List normalizeToArtifactRepositories( List remoteArtifactRepositories, String projectId )
|
||||
throws ProjectBuildingException
|
||||
{
|
||||
|
|
|
@ -75,15 +75,18 @@ public interface MavenRepositorySystem
|
|||
|
||||
// Repository creation
|
||||
|
||||
// maven model
|
||||
List<ArtifactRepository> buildArtifactRepositories( List<Repository> repositories )
|
||||
throws InvalidRepositoryException;
|
||||
|
||||
ArtifactRepository buildDeploymentArtifactRepository( DeploymentRepository repo )
|
||||
// maven model
|
||||
ArtifactRepository buildDeploymentArtifactRepository( DeploymentRepository repository )
|
||||
throws InvalidRepositoryException;
|
||||
|
||||
ArtifactRepository buildArtifactRepository( Repository repo )
|
||||
// maven model
|
||||
ArtifactRepository buildArtifactRepository( Repository repository )
|
||||
throws InvalidRepositoryException;
|
||||
|
||||
|
||||
ArtifactRepository createLocalRepository( String url, String repositoryId )
|
||||
throws IOException;
|
||||
|
||||
|
@ -91,9 +94,6 @@ public interface MavenRepositorySystem
|
|||
|
||||
ArtifactRepository createRepository( String url, String repositoryId, ArtifactRepositoryPolicy snapshotsPolicy, ArtifactRepositoryPolicy releasesPolicy );
|
||||
|
||||
List<ArtifactRepository> buildArtifactRepositories( Model model )
|
||||
throws ProjectBuildingException;
|
||||
|
||||
void setGlobalUpdatePolicy( String policy );
|
||||
|
||||
void setGlobalChecksumPolicy( String policy );
|
||||
|
|
|
@ -31,6 +31,7 @@ public class TestProjectBuilder
|
|||
@Requirement(hint="test")
|
||||
private ArtifactResolver artifactResolver;
|
||||
|
||||
@Requirement(hint="test")
|
||||
private MavenRepositorySystem repositorySystem;
|
||||
// Causing problems
|
||||
//@Requirement(hint="test")
|
||||
//private MavenRepositorySystem repositorySystem;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue