mirror of https://github.com/apache/maven.git
o in the middle of a ReactorArtifactRepository but ben and igor need access so checking in
git-svn-id: https://svn.apache.org/repos/asf/maven/components/branches/MNG-2766@772832 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
51c1cb584c
commit
a73c5abc9c
|
@ -23,11 +23,8 @@
|
|||
<artifactId>maven</artifactId>
|
||||
<version>3.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>apache-maven</artifactId>
|
||||
|
||||
<name>Maven Distribution</name>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
|
@ -58,14 +55,6 @@
|
|||
<groupId>org.apache.maven.wagon</groupId>
|
||||
<artifactId>wagon-http-lightweight</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven.wagon</groupId>
|
||||
<artifactId>wagon-ssh</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven.wagon</groupId>
|
||||
<artifactId>wagon-ssh-external</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven.wagon</groupId>
|
||||
<artifactId>wagon-file</artifactId>
|
||||
|
|
|
@ -38,9 +38,7 @@ import org.apache.maven.artifact.versioning.VersionRange;
|
|||
import org.codehaus.plexus.util.StringUtils;
|
||||
|
||||
/**
|
||||
* @author <a href="mailto:jason@maven.org">Jason van Zyl </a>
|
||||
* @version $Id$
|
||||
* @todo this should possibly be replaced by type handler
|
||||
* @author Jason van Zyl
|
||||
*/
|
||||
public class DefaultArtifact
|
||||
implements Artifact
|
||||
|
|
|
@ -180,9 +180,8 @@ public class DefaultArtifactFactory
|
|||
String inheritedScope,
|
||||
boolean optional )
|
||||
{
|
||||
// TODO: can refactor - inherited artifactScope calculation belongs in the collector, use artifactScope handler
|
||||
|
||||
String desiredScope = Artifact.SCOPE_RUNTIME;
|
||||
|
||||
if ( inheritedScope == null )
|
||||
{
|
||||
desiredScope = scope;
|
||||
|
|
|
@ -34,19 +34,7 @@ import org.apache.maven.artifact.versioning.ArtifactVersion;
|
|||
*/
|
||||
public interface ArtifactMetadataSource
|
||||
{
|
||||
String ROLE = ArtifactMetadataSource.class.getName();
|
||||
|
||||
ResolutionGroup retrieve( Artifact artifact,
|
||||
ArtifactRepository localRepository,
|
||||
List<ArtifactRepository> remoteRepositories )
|
||||
throws ArtifactMetadataRetrievalException;
|
||||
|
||||
/**
|
||||
* Resolve all relocations in the POM for this artifact, and return the new artifact coordinate.
|
||||
*/
|
||||
Artifact retrieveRelocatedArtifact( Artifact artifact,
|
||||
ArtifactRepository localRepository,
|
||||
List<ArtifactRepository> remoteRepositories )
|
||||
ResolutionGroup retrieve( Artifact artifact, ArtifactRepository localRepository, List<ArtifactRepository> remoteRepositories )
|
||||
throws ArtifactMetadataRetrievalException;
|
||||
|
||||
/**
|
||||
|
@ -61,9 +49,7 @@ public interface ArtifactMetadataSource
|
|||
* @throws ArtifactMetadataRetrievalException
|
||||
* in case of error while retrieving repository metadata from the repository.
|
||||
*/
|
||||
List<ArtifactVersion> retrieveAvailableVersions( Artifact artifact,
|
||||
ArtifactRepository localRepository,
|
||||
List<ArtifactRepository> remoteRepositories )
|
||||
List<ArtifactVersion> retrieveAvailableVersions( Artifact artifact, ArtifactRepository localRepository, List<ArtifactRepository> remoteRepositories )
|
||||
throws ArtifactMetadataRetrievalException;
|
||||
|
||||
/**
|
||||
|
@ -79,7 +65,6 @@ public interface ArtifactMetadataSource
|
|||
* @throws ArtifactMetadataRetrievalException
|
||||
* in case of error while retrieving repository metadata from the repository.
|
||||
*/
|
||||
List<ArtifactVersion> retrieveAvailableVersionsFromDeploymentRepository( Artifact artifact,
|
||||
ArtifactRepository localRepository,
|
||||
ArtifactRepository remoteRepository ) throws ArtifactMetadataRetrievalException;
|
||||
List<ArtifactVersion> retrieveAvailableVersionsFromDeploymentRepository( Artifact artifact, ArtifactRepository localRepository, ArtifactRepository remoteRepository )
|
||||
throws ArtifactMetadataRetrievalException;
|
||||
}
|
|
@ -19,12 +19,6 @@ import org.apache.maven.artifact.Artifact;
|
|||
import org.apache.maven.artifact.metadata.ArtifactMetadata;
|
||||
import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
|
||||
|
||||
/**
|
||||
* Specifies the repository used for artifact handling.
|
||||
*
|
||||
* @author <a href="mailto:brett@apache.org">Brett Porter</a>
|
||||
* @version $Id$
|
||||
*/
|
||||
public interface ArtifactRepository
|
||||
{
|
||||
String pathOf( Artifact artifact );
|
||||
|
@ -59,9 +53,11 @@ public interface ArtifactRepository
|
|||
|
||||
String getKey();
|
||||
|
||||
boolean isUniqueVersion();
|
||||
|
||||
void setBlacklisted( boolean blackListed );
|
||||
|
||||
boolean isBlacklisted();
|
||||
|
||||
// New interface methods for the repository system.
|
||||
|
||||
Artifact find( Artifact artifact );
|
||||
}
|
||||
|
|
|
@ -31,6 +31,7 @@ import org.apache.maven.wagon.repository.Repository;
|
|||
* @author <a href="michal.maczka@dimatics.com">Michal Maczka </a>
|
||||
* @version $Id$
|
||||
*/
|
||||
//TODO: this needs to be decoupled from Wagon
|
||||
public class DefaultArtifactRepository
|
||||
extends Repository
|
||||
implements ArtifactRepository
|
||||
|
@ -41,8 +42,6 @@ public class DefaultArtifactRepository
|
|||
|
||||
private ArtifactRepositoryPolicy releases;
|
||||
|
||||
private boolean uniqueVersion = true;
|
||||
|
||||
private boolean blacklisted;
|
||||
|
||||
/**
|
||||
|
@ -69,7 +68,6 @@ public class DefaultArtifactRepository
|
|||
{
|
||||
super( id, url );
|
||||
this.layout = layout;
|
||||
this.uniqueVersion = uniqueVersion;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -155,11 +153,6 @@ public class DefaultArtifactRepository
|
|||
return getId();
|
||||
}
|
||||
|
||||
public boolean isUniqueVersion()
|
||||
{
|
||||
return uniqueVersion;
|
||||
}
|
||||
|
||||
public boolean isBlacklisted()
|
||||
{
|
||||
return blacklisted;
|
||||
|
@ -184,4 +177,9 @@ public class DefaultArtifactRepository
|
|||
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public Artifact find( Artifact artifact )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -512,13 +512,6 @@ public class DefaultArtifactCollector
|
|||
artifact.selectVersion( version.toString() );
|
||||
fireEvent( ResolutionListener.SELECT_VERSION_FROM_RANGE, listeners, child );
|
||||
}
|
||||
|
||||
Artifact relocated = source.retrieveRelocatedArtifact( artifact, localRepository, childRemoteRepositories );
|
||||
if ( !artifact.equals( relocated ) )
|
||||
{
|
||||
artifact = relocated;
|
||||
child.setArtifact( artifact );
|
||||
}
|
||||
}
|
||||
while( !childKey.equals( child.getKey() ) );
|
||||
|
||||
|
|
|
@ -455,7 +455,6 @@ public class DefaultArtifactResolver
|
|||
}
|
||||
catch ( ArtifactMetadataRetrievalException e )
|
||||
{
|
||||
e.printStackTrace();
|
||||
// need to add metadata resolution exception
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -95,10 +95,8 @@ public class SnapshotTransformation
|
|||
if ( artifact.isSnapshot() )
|
||||
{
|
||||
Snapshot snapshot = new Snapshot();
|
||||
if ( remoteRepository.isUniqueVersion() )
|
||||
{
|
||||
snapshot.setTimestamp( getDeploymentTimestamp() );
|
||||
}
|
||||
|
||||
snapshot.setTimestamp( getDeploymentTimestamp() );
|
||||
|
||||
// we update the build number anyway so that it doesn't get lost. It requires the timestamp to take effect
|
||||
try
|
||||
|
|
|
@ -508,6 +508,36 @@ public class DefaultLifecycleExecutor
|
|||
|
||||
return mojoDescriptor;
|
||||
}
|
||||
|
||||
private static int count = 0;
|
||||
|
||||
// org.apache.maven.plugins:maven-remote-resources-plugin:1.0:process
|
||||
MojoDescriptor getMojoDescriptor( String groupId, String artifactId, String version, String goal, MavenProject project, ArtifactRepository localRepository )
|
||||
throws LifecycleExecutionException
|
||||
{
|
||||
Plugin plugin = new Plugin();
|
||||
plugin.setGroupId( groupId );
|
||||
plugin.setArtifactId( artifactId );
|
||||
plugin.setVersion( version );
|
||||
|
||||
MojoDescriptor mojoDescriptor;
|
||||
|
||||
//need to do the active project thing as the site plugin is referencing itself
|
||||
|
||||
if ( artifactId.equals( "maven-site-plugin" ) ){ count++; System.out.println( count ); };
|
||||
|
||||
System.out.println( ">>> " + artifactId );
|
||||
try
|
||||
{
|
||||
mojoDescriptor = pluginManager.getMojoDescriptor( plugin, goal, project, localRepository );
|
||||
}
|
||||
catch ( PluginLoaderException e )
|
||||
{
|
||||
throw new LifecycleExecutionException( "Error loading MojoDescriptor.", e );
|
||||
}
|
||||
|
||||
return mojoDescriptor;
|
||||
}
|
||||
|
||||
public void initialize()
|
||||
throws InitializationException
|
||||
|
@ -620,13 +650,13 @@ public class DefaultLifecycleExecutor
|
|||
public Set<Plugin> populateDefaultConfigurationForPlugins( Set<Plugin> plugins, MavenProject project, ArtifactRepository localRepository )
|
||||
throws LifecycleExecutionException
|
||||
{
|
||||
for( Plugin p: plugins )
|
||||
for( Plugin p : plugins )
|
||||
{
|
||||
for( PluginExecution e : p.getExecutions() )
|
||||
{
|
||||
for( String g : e.getGoals() )
|
||||
for( String goal : e.getGoals() )
|
||||
{
|
||||
Xpp3Dom dom = getDefaultPluginConfiguration( p.getGroupId(), p.getArtifactId(), p.getVersion(), g, project, localRepository );
|
||||
Xpp3Dom dom = getDefaultPluginConfiguration( p.getGroupId(), p.getArtifactId(), p.getVersion(), goal, project, localRepository );
|
||||
e.setConfiguration( Xpp3Dom.mergeXpp3Dom( (Xpp3Dom) e.getConfiguration(), dom, Boolean.TRUE ) );
|
||||
}
|
||||
}
|
||||
|
@ -638,8 +668,7 @@ public class DefaultLifecycleExecutor
|
|||
public Xpp3Dom getDefaultPluginConfiguration( String groupId, String artifactId, String version, String goal, MavenProject project, ArtifactRepository localRepository )
|
||||
throws LifecycleExecutionException
|
||||
{
|
||||
//return new Xpp3Dom( "configuration" );
|
||||
return convert( getMojoDescriptor( groupId+":"+artifactId+":"+version+":"+goal, project, localRepository ) );
|
||||
return convert( getMojoDescriptor( groupId, artifactId, version, goal, project, localRepository ) );
|
||||
}
|
||||
|
||||
public Xpp3Dom getMojoConfiguration( MojoDescriptor mojoDescriptor )
|
||||
|
|
|
@ -54,7 +54,6 @@ import org.apache.maven.project.DuplicateArtifactAttachmentException;
|
|||
import org.apache.maven.project.MavenProject;
|
||||
import org.apache.maven.project.artifact.InvalidDependencyVersionException;
|
||||
import org.apache.maven.repository.RepositorySystem;
|
||||
import org.apache.maven.repository.VersionNotFoundException;
|
||||
import org.codehaus.plexus.PlexusContainer;
|
||||
import org.codehaus.plexus.classworlds.realm.ClassRealm;
|
||||
import org.codehaus.plexus.component.annotations.Component;
|
||||
|
@ -149,10 +148,6 @@ public class DefaultPluginManager
|
|||
{
|
||||
throw new PluginLoaderException( plugin, "Failed to load plugin. Reason: " + e.getMessage(), e );
|
||||
}
|
||||
// catch ( InvalidPluginException e )
|
||||
// {
|
||||
// throw new PluginLoaderException( plugin, "Failed to load plugin. Reason: " + e.getMessage(), e );
|
||||
// }
|
||||
catch ( PluginVersionResolutionException e )
|
||||
{
|
||||
throw new PluginLoaderException( plugin, "Failed to load plugin. Reason: " + e.getMessage(), e );
|
||||
|
@ -588,31 +583,16 @@ public class DefaultPluginManager
|
|||
{
|
||||
MavenProject project = session.getCurrentProject();
|
||||
|
||||
// TODO: such a call in MavenMetadataSource too - packaging not really the intention of type
|
||||
Artifact artifact = repositorySystem.createArtifact( project.getGroupId(), project.getArtifactId(), project.getVersion(), null, project.getPackaging() );
|
||||
|
||||
// TODO: we don't need to resolve over and over again, as long as we are sure that the parameters are the same
|
||||
// check this with yourkit as a hot spot.
|
||||
// Don't recreate if already created - for effeciency, and because clover plugin adds to it
|
||||
if ( project.getDependencyArtifacts() == null )
|
||||
{
|
||||
// NOTE: Don't worry about covering this case with the error-reporter bindings...it's already handled by the project error reporter.
|
||||
try
|
||||
{
|
||||
project.setDependencyArtifacts( repositorySystem.createArtifacts( project.getDependencies(), null, null, project ) );
|
||||
}
|
||||
catch ( VersionNotFoundException e )
|
||||
{
|
||||
throw new InvalidDependencyVersionException( e.getProjectId(), e.getDependency(), e.getPomFile(), e.getCauseException() );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ArtifactFilter filter = new ScopeArtifactFilter( scope );
|
||||
|
||||
ArtifactResolutionRequest request = new ArtifactResolutionRequest()
|
||||
.setArtifact( artifact )
|
||||
// Here the root is not resolved because we are presumably working with a project locally.
|
||||
.setResolveRoot( false )
|
||||
.setArtifactDependencies( project.getDependencyArtifacts() )
|
||||
.setResolveTransitively( true )
|
||||
//.setArtifactDependencies( project.getDependencyArtifacts() )
|
||||
.setLocalRepository( session.getLocalRepository() )
|
||||
.setRemoteRepostories( project.getRemoteArtifactRepositories() )
|
||||
.setManagedVersionMap( project.getManagedVersionMap() )
|
||||
|
@ -622,6 +602,7 @@ public class DefaultPluginManager
|
|||
|
||||
resolutionErrorHandler.throwErrors( request, result );
|
||||
|
||||
//TODO: this is wrong
|
||||
project.setArtifacts( result.getArtifacts() );
|
||||
|
||||
ArtifactRepository localRepository = session.getLocalRepository();
|
||||
|
@ -698,11 +679,6 @@ public class DefaultPluginManager
|
|||
public MojoDescriptor getMojoDescriptor( Plugin plugin, String goal, MavenProject project, ArtifactRepository localRepository )
|
||||
throws PluginLoaderException
|
||||
{
|
||||
if ( plugin.getVersion() == null )
|
||||
{
|
||||
throw new IllegalArgumentException( "plugin.version: null" );
|
||||
}
|
||||
|
||||
PluginDescriptor pluginDescriptor = loadPlugin( plugin, project, localRepository );
|
||||
|
||||
MojoDescriptor mojoDescriptor = pluginDescriptor.getMojo( goal );
|
||||
|
|
|
@ -20,7 +20,6 @@ import java.io.IOException;
|
|||
import java.io.Reader;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
|
@ -71,26 +70,26 @@ public class DefaultMavenProjectBuilder
|
|||
{
|
||||
@Requirement
|
||||
private Logger logger;
|
||||
|
||||
|
||||
@Requirement
|
||||
private ModelValidator validator;
|
||||
|
||||
|
||||
@Requirement
|
||||
private LifecycleExecutor lifecycle;
|
||||
private LifecycleExecutor lifecycle;
|
||||
|
||||
@Requirement
|
||||
private RepositorySystem repositorySystem;
|
||||
|
||||
@Requirement
|
||||
List<ModelEventListener> listeners;
|
||||
|
||||
@Requirement
|
||||
private Interpolator interpolator;
|
||||
|
||||
@Requirement
|
||||
private ResolutionErrorHandler resolutionErrorHandler;
|
||||
|
||||
private static HashMap<String, MavenProject> hm = new HashMap<String, MavenProject>();
|
||||
@Requirement
|
||||
private Interpolator interpolator;
|
||||
|
||||
@Requirement
|
||||
private ResolutionErrorHandler resolutionErrorHandler;
|
||||
|
||||
//private static HashMap<String, MavenProject> hm = new HashMap<String, MavenProject>();
|
||||
|
||||
private MavenProject superProject;
|
||||
|
||||
|
@ -98,100 +97,85 @@ public class DefaultMavenProjectBuilder
|
|||
// MavenProjectBuilder Implementation
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
// This is used by the SITE plugin.
|
||||
public MavenProject build( File project, ArtifactRepository localRepository, ProfileManager profileManager )
|
||||
throws ProjectBuildingException
|
||||
{
|
||||
ProjectBuilderConfiguration configuration = new DefaultProjectBuilderConfiguration()
|
||||
.setLocalRepository( localRepository )
|
||||
.setGlobalProfileManager( profileManager );
|
||||
|
||||
return build( project, configuration );
|
||||
}
|
||||
|
||||
public MavenProject build( File pomFile, ProjectBuilderConfiguration configuration )
|
||||
throws ProjectBuildingException
|
||||
{
|
||||
//Do inheritance
|
||||
DomainModel domainModel;
|
||||
try
|
||||
{
|
||||
domainModel = build( "unknown", pomFile, configuration );
|
||||
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
throw new ProjectBuildingException("", "", e);
|
||||
}
|
||||
|
||||
//Profiles
|
||||
|
||||
List<Profile> projectProfiles;
|
||||
Properties props = new Properties();
|
||||
props.putAll(configuration.getExecutionProperties());
|
||||
|
||||
try
|
||||
{
|
||||
projectProfiles = DefaultProfileManager.getActiveProfilesFrom(configuration.getGlobalProfileManager(), props, domainModel.getModel() );
|
||||
}
|
||||
catch ( ProfileActivationException e )
|
||||
{
|
||||
throw new ProjectBuildingException( "", "Failed to activate pom profiles.");
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
List<Profile> externalProfiles = new ArrayList<Profile>();
|
||||
for(Profile p : projectProfiles)
|
||||
{
|
||||
if(!"pom".equals(p.getSource()))
|
||||
{
|
||||
logger.debug("Merging profile into model (build): Model = " + domainModel.getId() + ", Profile = " + p.getId() );
|
||||
externalProfiles.add(p);
|
||||
}
|
||||
}
|
||||
|
||||
domainModel = ProcessorContext.mergeProfilesIntoModel( externalProfiles, domainModel );
|
||||
domainModel = build( "unknown", pomFile, configuration );
|
||||
}
|
||||
catch ( IOException e )
|
||||
{
|
||||
throw new ProjectBuildingException("", "");
|
||||
throw new ProjectBuildingException( "", "", e );
|
||||
}
|
||||
|
||||
|
||||
//Profiles
|
||||
|
||||
List<Profile> projectProfiles;
|
||||
Properties props = new Properties();
|
||||
props.putAll( configuration.getExecutionProperties() );
|
||||
|
||||
try
|
||||
{
|
||||
projectProfiles = DefaultProfileManager.getActiveProfilesFrom( configuration.getGlobalProfileManager(), props, domainModel.getModel() );
|
||||
}
|
||||
catch ( ProfileActivationException e )
|
||||
{
|
||||
throw new ProjectBuildingException( "", "Failed to activate pom profiles." );
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
List<Profile> externalProfiles = new ArrayList<Profile>();
|
||||
for ( Profile p : projectProfiles )
|
||||
{
|
||||
if ( !"pom".equals( p.getSource() ) )
|
||||
{
|
||||
logger.debug( "Merging profile into model (build): Model = " + domainModel.getId() + ", Profile = " + p.getId() );
|
||||
externalProfiles.add( p );
|
||||
}
|
||||
}
|
||||
|
||||
domainModel = ProcessorContext.mergeProfilesIntoModel( externalProfiles, domainModel );
|
||||
}
|
||||
catch ( IOException e )
|
||||
{
|
||||
throw new ProjectBuildingException( "", "" );
|
||||
}
|
||||
|
||||
//Interpolation & Management
|
||||
MavenProject project;
|
||||
try
|
||||
{
|
||||
Model model = interpolateDomainModel( domainModel, configuration, pomFile );
|
||||
|
||||
List<Plugin> plns = new ArrayList<Plugin>();
|
||||
|
||||
Set<Plugin> plugins = lifecycle.getPluginsBoundByDefaultToAllLifecycles(model.getPackaging());
|
||||
try
|
||||
{
|
||||
Model model = interpolateDomainModel( domainModel, configuration, pomFile );
|
||||
|
||||
Set<Plugin> plugins = lifecycle.getPluginsBoundByDefaultToAllLifecycles( model.getPackaging() );
|
||||
|
||||
addPluginsToModel( model, plugins );
|
||||
|
||||
ProcessorContext.processManagementNodes( model );
|
||||
|
||||
project = this.fromDomainModelToMavenProject( model, domainModel.getParentFile(), configuration, pomFile );
|
||||
|
||||
Set<Plugin> pluginsFromProject = new HashSet<Plugin>();
|
||||
for ( Plugin p : project.getModel().getBuild().getPlugins() )
|
||||
{
|
||||
Plugin copy = new Plugin();
|
||||
PluginProcessor.copy2( p, copy, true );
|
||||
pluginsFromProject.add( copy );
|
||||
}
|
||||
|
||||
addPluginsToModel(model, plugins);
|
||||
|
||||
ProcessorContext.processManagementNodes(model);
|
||||
|
||||
project = this.fromDomainModelToMavenProject(model, domainModel.getParentFile(), configuration, pomFile);
|
||||
|
||||
ArrayList<Plugin> pln = new ArrayList<Plugin>();
|
||||
for(Plugin p : project.getModel().getBuild().getPlugins())
|
||||
{
|
||||
Plugin copy = new Plugin();
|
||||
PluginProcessor.copy2(p, copy, true);
|
||||
pln.add(copy);
|
||||
}
|
||||
|
||||
// Merge the various sources for mojo configuration:
|
||||
// 1. default values from mojo descriptor
|
||||
// 2. POM values from per-plugin configuration
|
||||
// 3. POM values from per-execution configuration
|
||||
// These configuration sources are given in increasing order of dominance.
|
||||
|
||||
Set<Plugin> pl = lifecycle.populateDefaultConfigurationForPlugins(new HashSet<Plugin>(pln),
|
||||
project, configuration.getLocalRepository());
|
||||
|
||||
for ( Plugin buildPlugin : pl )
|
||||
Set<Plugin> processedPlugins = lifecycle.populateDefaultConfigurationForPlugins( pluginsFromProject, project, configuration.getLocalRepository() );
|
||||
|
||||
for ( Plugin buildPlugin : processedPlugins )
|
||||
{
|
||||
Xpp3Dom dom = (Xpp3Dom) buildPlugin.getConfiguration();
|
||||
Plugin x = containsPlugin( buildPlugin, project.getModel().getBuild().getPlugins() );
|
||||
|
@ -210,30 +194,27 @@ public class DefaultMavenProjectBuilder
|
|||
PluginExecution pe = contains( g, x.getExecutions() );
|
||||
if ( pe != null )
|
||||
{
|
||||
Xpp3Dom dom2 =
|
||||
Xpp3Dom.mergeXpp3Dom( (Xpp3Dom) pe.getConfiguration(),
|
||||
(Xpp3Dom) e.getConfiguration() );
|
||||
Xpp3Dom dom2 = Xpp3Dom.mergeXpp3Dom( (Xpp3Dom) pe.getConfiguration(), (Xpp3Dom) e.getConfiguration() );
|
||||
e.setConfiguration( dom2 );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
project.getModel().getBuild().setPlugins(new ArrayList<Plugin>(pl));
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
throw new ProjectBuildingException("", "");
|
||||
}
|
||||
catch (LifecycleExecutionException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
throw new ProjectBuildingException("",e.getMessage());
|
||||
}
|
||||
project.setActiveProfiles( projectProfiles );
|
||||
|
||||
|
||||
project.getModel().getBuild().setPlugins( new ArrayList<Plugin>( processedPlugins ) );
|
||||
}
|
||||
catch ( IOException e )
|
||||
{
|
||||
throw new ProjectBuildingException( "", "" );
|
||||
}
|
||||
catch ( LifecycleExecutionException e )
|
||||
{
|
||||
throw new ProjectBuildingException( "", e.getMessage() );
|
||||
}
|
||||
|
||||
//project.setActiveProfiles( projectProfiles );
|
||||
|
||||
Build build = project.getBuild();
|
||||
// NOTE: setting this script-source root before path translation, because
|
||||
// the plugin tools compose basedir and scriptSourceRoot into a single file.
|
||||
|
@ -241,95 +222,15 @@ public class DefaultMavenProjectBuilder
|
|||
project.addCompileSourceRoot( build.getSourceDirectory() );
|
||||
project.addTestCompileSourceRoot( build.getTestSourceDirectory() );
|
||||
project.setFile( pomFile );
|
||||
|
||||
|
||||
setBuildOutputDirectoryOnParent( project );
|
||||
|
||||
hm.put( ArtifactUtils.artifactId( project.getGroupId(), project.getArtifactId(), "pom", project.getVersion() ), project );
|
||||
|
||||
return project;
|
||||
}
|
||||
|
||||
private static PluginExecution contains(String goal, List<PluginExecution> plugins)
|
||||
{
|
||||
for(PluginExecution pe : plugins)
|
||||
{
|
||||
if(pe.getGoals().contains(goal))
|
||||
{
|
||||
return pe;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void addPluginsToModel( Model target, Set<Plugin> plugins )
|
||||
{
|
||||
List<Plugin> mngPlugins = (target.getBuild().getPluginManagement() != null)
|
||||
? target.getBuild().getPluginManagement().getPlugins() : new ArrayList<Plugin>();
|
||||
|
||||
List<Plugin> pomPlugins = new ArrayList<Plugin>(target.getBuild().getPlugins());
|
||||
|
||||
List<Plugin> lifecyclePlugins = new ArrayList<Plugin>();
|
||||
|
||||
for( Plugin p : plugins )
|
||||
{
|
||||
//Go ahead and add version if exists in pluginManagement - don't use default version
|
||||
Plugin mngPlugin = containsPlugin(p, mngPlugins);
|
||||
if(mngPlugin != null && mngPlugin.getVersion() != null)
|
||||
{
|
||||
//System.out.println("Set version:" + p.getVersion() + ": To = " + mngPlugin.getVersion());
|
||||
p.setVersion(mngPlugin.getVersion());
|
||||
}
|
||||
|
||||
Plugin pomPlugin = containsPlugin( p, pomPlugins);
|
||||
if ( pomPlugin == null )
|
||||
{
|
||||
lifecyclePlugins.add( p );
|
||||
}
|
||||
else
|
||||
{
|
||||
PluginProcessor.copy2( p, pomPlugin, true );
|
||||
if ( p.getConfiguration() != null )
|
||||
{
|
||||
System.out.println( Xpp3Dom.mergeXpp3Dom( (Xpp3Dom) p.getConfiguration(),
|
||||
(Xpp3Dom) pomPlugin.getConfiguration() ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
pomPlugins.addAll(lifecyclePlugins);
|
||||
target.getBuild().setPlugins(pomPlugins);
|
||||
|
||||
}
|
||||
|
||||
private static Plugin containsPlugin(Plugin plugin, List<Plugin> plugins)
|
||||
{
|
||||
for(Plugin p : plugins)
|
||||
{
|
||||
if( p.getGroupId().equals(plugin.getGroupId()) && p.getArtifactId().equals(plugin.getArtifactId()))
|
||||
{
|
||||
return p;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public MavenProject buildFromRepository( Artifact artifact, List<ArtifactRepository> remoteRepositories, ArtifactRepository localRepository )
|
||||
throws ProjectBuildingException
|
||||
{
|
||||
return buildFromRepository( artifact, new DefaultProjectBuilderConfiguration( localRepository, remoteRepositories ) );
|
||||
}
|
||||
|
||||
public MavenProject buildFromRepository( Artifact artifact, ProjectBuilderConfiguration configuration )
|
||||
throws ProjectBuildingException
|
||||
{
|
||||
MavenProject project = hm.get( artifact.getId() );
|
||||
|
||||
if ( project != null )
|
||||
{
|
||||
return project;
|
||||
}
|
||||
|
||||
if ( !artifact.getType().equals( "pom" ) )
|
||||
{
|
||||
artifact = repositorySystem.createProjectArtifact( artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion() );
|
||||
|
@ -346,62 +247,24 @@ public class DefaultMavenProjectBuilder
|
|||
{
|
||||
throw new ProjectBuildingException( artifact.getId(), "Error resolving project artifact.", e );
|
||||
}
|
||||
DomainModel domainModel;
|
||||
try
|
||||
{
|
||||
domainModel = build( "unknown", artifact.getFile(), configuration );
|
||||
}
|
||||
catch ( IOException e )
|
||||
{
|
||||
throw new ProjectBuildingException( artifact.getId(), "Error reading project artifact.", e );
|
||||
}
|
||||
|
||||
List<Profile> projectProfiles;
|
||||
Properties props = new Properties();
|
||||
props.putAll( configuration.getExecutionProperties() );
|
||||
// props.putAll(configuration.getUserProperties());
|
||||
return build( artifact.getFile(), configuration );
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
projectProfiles = DefaultProfileManager.getActiveProfilesFrom( configuration.getGlobalProfileManager(), props, domainModel.getModel() );
|
||||
}
|
||||
catch ( ProfileActivationException e )
|
||||
{
|
||||
throw new ProjectBuildingException( "", "Failed to activate pom profiles." );
|
||||
}
|
||||
// This is used by the SITE plugin.
|
||||
public MavenProject build( File project, ArtifactRepository localRepository, ProfileManager profileManager )
|
||||
throws ProjectBuildingException
|
||||
{
|
||||
ProjectBuilderConfiguration configuration = new DefaultProjectBuilderConfiguration().setLocalRepository( localRepository ).setGlobalProfileManager( profileManager );
|
||||
|
||||
try
|
||||
{
|
||||
for ( Profile p : projectProfiles )
|
||||
{
|
||||
logger.debug( "Merging profile into model (buildFromRepository): Model = " + domainModel.getId() + ", Profile = " + p.getId() );
|
||||
}
|
||||
return build( project, configuration );
|
||||
}
|
||||
|
||||
domainModel = ProcessorContext.mergeProfilesIntoModel( projectProfiles, domainModel );
|
||||
}
|
||||
catch ( IOException e )
|
||||
{
|
||||
throw new ProjectBuildingException( "", "" );
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
Model model = ProcessorContext.processManagementNodes( interpolateDomainModel( domainModel, configuration, artifact.getFile() ) );
|
||||
project = this.fromDomainModelToMavenProject( model, domainModel.getParentFile(), configuration, artifact.getFile() );
|
||||
}
|
||||
catch ( IOException e )
|
||||
{
|
||||
throw new ProjectBuildingException( "", "" );
|
||||
}
|
||||
|
||||
project.setActiveProfiles( projectProfiles );
|
||||
artifact.setFile( artifact.getFile() );
|
||||
project.setVersion( artifact.getVersion() );
|
||||
|
||||
hm.put( artifact.getId(), project );
|
||||
|
||||
return project;
|
||||
}
|
||||
public MavenProject buildFromRepository( Artifact artifact, List<ArtifactRepository> remoteRepositories, ArtifactRepository localRepository )
|
||||
throws ProjectBuildingException
|
||||
{
|
||||
return buildFromRepository( artifact, new DefaultProjectBuilderConfiguration( localRepository, remoteRepositories ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* This is used for pom-less execution like running archetype:generate.
|
||||
|
@ -440,27 +303,86 @@ public class DefaultMavenProjectBuilder
|
|||
Artifact pomArtifact = repositorySystem.createProjectArtifact( project.getGroupId(), project.getArtifactId(), project.getVersion() );
|
||||
pomArtifact.setFile( pomFile );
|
||||
|
||||
ArtifactResolutionRequest request = new ArtifactResolutionRequest()
|
||||
.setArtifact( pomArtifact )
|
||||
.setArtifactDependencies( project.getDependencyArtifacts() )
|
||||
.setLocalRepository( configuration.getLocalRepository() )
|
||||
.setRemoteRepostories( project.getRemoteArtifactRepositories() )
|
||||
.setManagedVersionMap( project.getManagedVersionMap() );
|
||||
|
||||
ArtifactResolutionRequest request = new ArtifactResolutionRequest().setArtifact( pomArtifact ).setArtifactDependencies( project.getDependencyArtifacts() )
|
||||
.setLocalRepository( configuration.getLocalRepository() ).setRemoteRepostories( project.getRemoteArtifactRepositories() ).setManagedVersionMap( project.getManagedVersionMap() );
|
||||
|
||||
ArtifactResolutionResult result = repositorySystem.resolve( request );
|
||||
|
||||
if ( result.hasExceptions() )
|
||||
{
|
||||
Exception e = result.getExceptions().get( 0 );
|
||||
|
||||
throw new ProjectBuildingException( safeVersionlessKey( project.getGroupId(), project.getArtifactId() ), "Unable to build project due to an invalid dependency version: " + e.getMessage(), pomFile, e );
|
||||
throw new ProjectBuildingException( safeVersionlessKey( project.getGroupId(), project.getArtifactId() ), "Unable to build project due to an invalid dependency version: " + e.getMessage(),
|
||||
pomFile, e );
|
||||
}
|
||||
|
||||
project.setArtifacts( result.getArtifacts() );
|
||||
|
||||
return new MavenProjectBuildingResult( project, result );
|
||||
}
|
||||
|
||||
|
||||
private static PluginExecution contains( String goal, List<PluginExecution> plugins )
|
||||
{
|
||||
for ( PluginExecution pe : plugins )
|
||||
{
|
||||
if ( pe.getGoals().contains( goal ) )
|
||||
{
|
||||
return pe;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void addPluginsToModel( Model target, Set<Plugin> plugins )
|
||||
{
|
||||
List<Plugin> mngPlugins = ( target.getBuild().getPluginManagement() != null ) ? target.getBuild().getPluginManagement().getPlugins() : new ArrayList<Plugin>();
|
||||
|
||||
List<Plugin> pomPlugins = new ArrayList<Plugin>( target.getBuild().getPlugins() );
|
||||
|
||||
List<Plugin> lifecyclePlugins = new ArrayList<Plugin>();
|
||||
|
||||
for ( Plugin p : plugins )
|
||||
{
|
||||
//Go ahead and add version if exists in pluginManagement - don't use default version
|
||||
Plugin mngPlugin = containsPlugin( p, mngPlugins );
|
||||
if ( mngPlugin != null && mngPlugin.getVersion() != null )
|
||||
{
|
||||
//System.out.println("Set version:" + p.getVersion() + ": To = " + mngPlugin.getVersion());
|
||||
p.setVersion( mngPlugin.getVersion() );
|
||||
}
|
||||
|
||||
Plugin pomPlugin = containsPlugin( p, pomPlugins );
|
||||
if ( pomPlugin == null )
|
||||
{
|
||||
lifecyclePlugins.add( p );
|
||||
}
|
||||
else
|
||||
{
|
||||
PluginProcessor.copy2( p, pomPlugin, true );
|
||||
if ( p.getConfiguration() != null )
|
||||
{
|
||||
System.out.println( Xpp3Dom.mergeXpp3Dom( (Xpp3Dom) p.getConfiguration(), (Xpp3Dom) pomPlugin.getConfiguration() ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
pomPlugins.addAll( lifecyclePlugins );
|
||||
target.getBuild().setPlugins( pomPlugins );
|
||||
|
||||
}
|
||||
|
||||
private static Plugin containsPlugin( Plugin plugin, List<Plugin> plugins )
|
||||
{
|
||||
for ( Plugin p : plugins )
|
||||
{
|
||||
if ( p.getGroupId().equals( plugin.getGroupId() ) && p.getArtifactId().equals( plugin.getArtifactId() ) )
|
||||
{
|
||||
return p;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private Model interpolateDomainModel( DomainModel domainModel, ProjectBuilderConfiguration config, File projectDescriptor )
|
||||
throws ProjectBuildingException
|
||||
{
|
||||
|
@ -474,15 +396,14 @@ public class DefaultMavenProjectBuilder
|
|||
}
|
||||
catch ( IOException e )
|
||||
{
|
||||
|
||||
throw new ProjectBuildingException( projectId, "", projectDescriptor, e );
|
||||
}
|
||||
|
||||
return model;
|
||||
}
|
||||
|
||||
private MavenProject fromDomainModelToMavenProject(Model model, File parentFile, ProjectBuilderConfiguration config, File projectDescriptor)
|
||||
throws InvalidProjectModelException, IOException
|
||||
|
||||
private MavenProject fromDomainModelToMavenProject( Model model, File parentFile, ProjectBuilderConfiguration config, File projectDescriptor )
|
||||
throws InvalidProjectModelException, IOException
|
||||
{
|
||||
MavenProject project;
|
||||
String projectId = safeVersionlessKey( model.getGroupId(), model.getArtifactId() );
|
||||
|
@ -503,9 +424,9 @@ public class DefaultMavenProjectBuilder
|
|||
throw new InvalidProjectModelException( projectId, e.getMessage(), projectDescriptor, e );
|
||||
}
|
||||
|
||||
return project;
|
||||
return project;
|
||||
}
|
||||
|
||||
|
||||
private DomainModel build( String projectId, File pomFile, ProjectBuilderConfiguration projectBuilderConfiguration )
|
||||
throws ProjectBuildingException, IOException
|
||||
{
|
||||
|
@ -515,97 +436,97 @@ public class DefaultMavenProjectBuilder
|
|||
List<String> inactiveProfileIds = ( projectBuilderConfiguration != null && projectBuilderConfiguration.getGlobalProfileManager() != null && projectBuilderConfiguration
|
||||
.getGlobalProfileManager().getProfileActivationContext() != null ) ? projectBuilderConfiguration.getGlobalProfileManager().getProfileActivationContext().getExplicitlyInactiveProfileIds()
|
||||
: new ArrayList<String>();
|
||||
|
||||
ProfileManagerInfo profileInfo = new ProfileManagerInfo(projectBuilderConfiguration.getExecutionProperties(), activeProfileIds, inactiveProfileIds);
|
||||
DomainModel domainModel = new DomainModel( pomFile );
|
||||
domainModel.setProjectDirectory( pomFile.getParentFile() );
|
||||
domainModel.setMostSpecialized( true );
|
||||
|
||||
List<DomainModel> domainModels = new ArrayList<DomainModel>();
|
||||
ProfileManagerInfo profileInfo = new ProfileManagerInfo( projectBuilderConfiguration.getExecutionProperties(), activeProfileIds, inactiveProfileIds );
|
||||
DomainModel domainModel = new DomainModel( pomFile );
|
||||
domainModel.setProjectDirectory( pomFile.getParentFile() );
|
||||
domainModel.setMostSpecialized( true );
|
||||
|
||||
domainModels.add( domainModel );
|
||||
ArtifactRepository localRepository = projectBuilderConfiguration.getLocalRepository();
|
||||
List<ArtifactRepository> remoteRepositories = projectBuilderConfiguration.getRemoteRepositories();
|
||||
List<DomainModel> domainModels = new ArrayList<DomainModel>();
|
||||
|
||||
File parentFile = null;
|
||||
int lineageCount = 0;
|
||||
if ( domainModel.getParentId() != null )
|
||||
domainModels.add( domainModel );
|
||||
ArtifactRepository localRepository = projectBuilderConfiguration.getLocalRepository();
|
||||
List<ArtifactRepository> remoteRepositories = projectBuilderConfiguration.getRemoteRepositories();
|
||||
|
||||
File parentFile = null;
|
||||
int lineageCount = 0;
|
||||
if ( domainModel.getParentId() != null )
|
||||
{
|
||||
List<DomainModel> mavenParents;
|
||||
MavenProject topProject = projectBuilderConfiguration.getTopLevelProjectFromReactor();
|
||||
if ( useTopLevelProjectForParent( domainModel, topProject ) )
|
||||
{
|
||||
List<DomainModel> mavenParents;
|
||||
MavenProject topProject = projectBuilderConfiguration.getTopLevelProjectFromReactor();
|
||||
if(useTopLevelProjectForParent(domainModel, topProject) )
|
||||
{
|
||||
mavenParents = getDomainModelParentsFromLocalPath( domainModel, localRepository, remoteRepositories, topProject.getFile(), projectBuilderConfiguration );
|
||||
}
|
||||
else if ( isParentLocal( domainModel.getRelativePathOfParent(), pomFile.getParentFile() ) )
|
||||
{
|
||||
mavenParents = getDomainModelParentsFromLocalPath( domainModel, localRepository, remoteRepositories, pomFile.getParentFile(), projectBuilderConfiguration );
|
||||
}
|
||||
else
|
||||
{
|
||||
mavenParents = getDomainModelParentsFromRepository( domainModel, localRepository, remoteRepositories );
|
||||
}
|
||||
|
||||
if ( mavenParents.size() > 0 )
|
||||
{
|
||||
DomainModel dm = (DomainModel) mavenParents.get( 0 );
|
||||
parentFile = dm.getFile();
|
||||
domainModel.setParentFile( parentFile );
|
||||
lineageCount = mavenParents.size();
|
||||
}
|
||||
|
||||
domainModels.addAll( mavenParents );
|
||||
mavenParents = getDomainModelParentsFromLocalPath( domainModel, localRepository, remoteRepositories, topProject.getFile(), projectBuilderConfiguration );
|
||||
}
|
||||
else if ( isParentLocal( domainModel.getRelativePathOfParent(), pomFile.getParentFile() ) )
|
||||
{
|
||||
mavenParents = getDomainModelParentsFromLocalPath( domainModel, localRepository, remoteRepositories, pomFile.getParentFile(), projectBuilderConfiguration );
|
||||
}
|
||||
else
|
||||
{
|
||||
mavenParents = getDomainModelParentsFromRepository( domainModel, localRepository, remoteRepositories );
|
||||
}
|
||||
|
||||
domainModels.add( new DomainModel( getSuperModel(), false ) );
|
||||
List<DomainModel> profileModels = new ArrayList<DomainModel>();
|
||||
//Process Profiles
|
||||
for(DomainModel domain : domainModels)
|
||||
if ( mavenParents.size() > 0 )
|
||||
{
|
||||
DomainModel dm = (DomainModel) domain;
|
||||
|
||||
if(!dm.getModel().getProfiles().isEmpty())
|
||||
{
|
||||
Collection<Profile> profiles = DefaultProfileManager.getActiveProfiles(dm.getModel().getProfiles(), profileInfo);
|
||||
if(!profiles.isEmpty())
|
||||
{
|
||||
for(Profile p : profiles)
|
||||
{
|
||||
logger.debug("Merging profile into model: Model = " + dm.getId() + ", Profile = " + p.getId() );
|
||||
}
|
||||
profileModels.add(ProcessorContext.mergeProfilesIntoModel( profiles, dm ));
|
||||
}
|
||||
else
|
||||
{
|
||||
profileModels.add( dm );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
profileModels.add( dm );
|
||||
}
|
||||
DomainModel dm = (DomainModel) mavenParents.get( 0 );
|
||||
parentFile = dm.getFile();
|
||||
domainModel.setParentFile( parentFile );
|
||||
lineageCount = mavenParents.size();
|
||||
}
|
||||
|
||||
DomainModel transformedDomainModel = ProcessorContext.build(profileModels, listeners);
|
||||
domainModels.addAll( mavenParents );
|
||||
}
|
||||
|
||||
// Lineage count is inclusive to add the POM read in itself.
|
||||
transformedDomainModel.setLineageCount( lineageCount + 1 );
|
||||
transformedDomainModel.setParentFile( parentFile );
|
||||
domainModels.add( new DomainModel( getSuperModel(), false ) );
|
||||
List<DomainModel> profileModels = new ArrayList<DomainModel>();
|
||||
//Process Profiles
|
||||
for ( DomainModel domain : domainModels )
|
||||
{
|
||||
DomainModel dm = (DomainModel) domain;
|
||||
|
||||
return transformedDomainModel;
|
||||
if ( !dm.getModel().getProfiles().isEmpty() )
|
||||
{
|
||||
Collection<Profile> profiles = DefaultProfileManager.getActiveProfiles( dm.getModel().getProfiles(), profileInfo );
|
||||
if ( !profiles.isEmpty() )
|
||||
{
|
||||
for ( Profile p : profiles )
|
||||
{
|
||||
logger.debug( "Merging profile into model: Model = " + dm.getId() + ", Profile = " + p.getId() );
|
||||
}
|
||||
profileModels.add( ProcessorContext.mergeProfilesIntoModel( profiles, dm ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
profileModels.add( dm );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
profileModels.add( dm );
|
||||
}
|
||||
}
|
||||
|
||||
DomainModel transformedDomainModel = ProcessorContext.build( profileModels, listeners );
|
||||
|
||||
// Lineage count is inclusive to add the POM read in itself.
|
||||
transformedDomainModel.setLineageCount( lineageCount + 1 );
|
||||
transformedDomainModel.setParentFile( parentFile );
|
||||
|
||||
return transformedDomainModel;
|
||||
}
|
||||
|
||||
private static boolean useTopLevelProjectForParent(DomainModel currentModel, MavenProject topProject) throws IOException
|
||||
{
|
||||
if(topProject == null || currentModel.getModel().getParent() == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return topProject.getGroupId().equals(currentModel.getParentGroupId())
|
||||
&& topProject.getArtifactId().equals(currentModel.getParentArtifactId())
|
||||
&& topProject.getVersion().equals(currentModel.getParentVersion());
|
||||
|
||||
private static boolean useTopLevelProjectForParent( DomainModel currentModel, MavenProject topProject )
|
||||
throws IOException
|
||||
{
|
||||
if ( topProject == null || currentModel.getModel().getParent() == null )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return topProject.getGroupId().equals( currentModel.getParentGroupId() ) && topProject.getArtifactId().equals( currentModel.getParentArtifactId() )
|
||||
&& topProject.getVersion().equals( currentModel.getParentVersion() );
|
||||
|
||||
}
|
||||
|
||||
private void validateModel( Model model, File pomFile )
|
||||
|
@ -683,14 +604,14 @@ public class DefaultMavenProjectBuilder
|
|||
}
|
||||
}
|
||||
|
||||
private List<DomainModel> getDomainModelParentsFromRepository( DomainModel domainModel, ArtifactRepository localRepository, List<ArtifactRepository> remoteRepositories )
|
||||
private List<DomainModel> getDomainModelParentsFromRepository( DomainModel domainModel, ArtifactRepository localRepository, List<ArtifactRepository> remoteRepositories )
|
||||
throws IOException
|
||||
{
|
||||
List<DomainModel> domainModels = new ArrayList<DomainModel>();
|
||||
|
||||
String parentId = domainModel.getParentId();
|
||||
|
||||
if ( parentId == null || localRepository == null)
|
||||
if ( parentId == null || localRepository == null )
|
||||
{
|
||||
return domainModels;
|
||||
}
|
||||
|
@ -699,24 +620,22 @@ public class DefaultMavenProjectBuilder
|
|||
|
||||
ArtifactResolutionRequest request = new ArtifactResolutionRequest( artifactParent, localRepository, remoteRepositories );
|
||||
ArtifactResolutionResult result;
|
||||
try
|
||||
{
|
||||
result = repositorySystem.resolve( request );
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw (IOException) new IOException( "The parent POM " + artifactParent
|
||||
+ " could not be retrieved from any repository" ).initCause( e );
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
result = repositorySystem.resolve( request );
|
||||
}
|
||||
catch ( Exception e )
|
||||
{
|
||||
throw (IOException) new IOException( "The parent POM " + artifactParent + " could not be retrieved from any repository" ).initCause( e );
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
resolutionErrorHandler.throwErrors( request, result );
|
||||
}
|
||||
catch ( ArtifactResolutionException e )
|
||||
{
|
||||
throw (IOException) new IOException( "The parent POM " + artifactParent
|
||||
+ " could not be retrieved from any repository" ).initCause( e );
|
||||
throw (IOException) new IOException( "The parent POM " + artifactParent + " could not be retrieved from any repository" ).initCause( e );
|
||||
}
|
||||
|
||||
DomainModel parentDomainModel = new DomainModel( artifactParent.getFile() );
|
||||
|
@ -726,7 +645,7 @@ public class DefaultMavenProjectBuilder
|
|||
//shane: what does this mean exactly and why does it occur
|
||||
logger.debug( "Parent pom ids do not match: Parent File = " + artifactParent.getFile().getAbsolutePath() + ": Child ID = " + domainModel.getId() );
|
||||
|
||||
// return domainModels;
|
||||
// return domainModels;
|
||||
}
|
||||
|
||||
domainModels.add( parentDomainModel );
|
||||
|
@ -744,8 +663,8 @@ public class DefaultMavenProjectBuilder
|
|||
* @return
|
||||
* @throws IOException
|
||||
*/
|
||||
private List<DomainModel> getDomainModelParentsFromLocalPath( DomainModel domainModel, ArtifactRepository localRepository, List<ArtifactRepository> remoteRepositories,
|
||||
File projectDirectory, ProjectBuilderConfiguration projectBuilderConfiguration )
|
||||
private List<DomainModel> getDomainModelParentsFromLocalPath( DomainModel domainModel, ArtifactRepository localRepository, List<ArtifactRepository> remoteRepositories, File projectDirectory,
|
||||
ProjectBuilderConfiguration projectBuilderConfiguration )
|
||||
throws IOException
|
||||
{
|
||||
List<DomainModel> domainModels = new ArrayList<DomainModel>();
|
||||
|
@ -756,27 +675,27 @@ public class DefaultMavenProjectBuilder
|
|||
{
|
||||
return domainModels;
|
||||
}
|
||||
|
||||
|
||||
File parentFile = new File( projectDirectory, domainModel.getRelativePathOfParent() ).getCanonicalFile();
|
||||
if ( parentFile.isDirectory() )
|
||||
{
|
||||
parentFile = new File( parentFile.getAbsolutePath(), "pom.xml" );
|
||||
}
|
||||
MavenProject topProject = projectBuilderConfiguration.getTopLevelProjectFromReactor();
|
||||
boolean isTop = useTopLevelProjectForParent(domainModel, topProject);
|
||||
DomainModel parentDomainModel = null;
|
||||
if ( !isTop )
|
||||
MavenProject topProject = projectBuilderConfiguration.getTopLevelProjectFromReactor();
|
||||
boolean isTop = useTopLevelProjectForParent( domainModel, topProject );
|
||||
DomainModel parentDomainModel = null;
|
||||
if ( !isTop )
|
||||
{
|
||||
if(!parentFile.isFile())
|
||||
{
|
||||
throw new IOException( "File does not exist: File = " + parentFile.getAbsolutePath() );
|
||||
}
|
||||
parentDomainModel = new DomainModel( parentFile );
|
||||
parentDomainModel.setProjectDirectory( parentFile.getParentFile() );
|
||||
if ( !parentFile.isFile() )
|
||||
{
|
||||
throw new IOException( "File does not exist: File = " + parentFile.getAbsolutePath() );
|
||||
}
|
||||
parentDomainModel = new DomainModel( parentFile );
|
||||
parentDomainModel.setProjectDirectory( parentFile.getParentFile() );
|
||||
}
|
||||
else
|
||||
{
|
||||
parentDomainModel = new DomainModel(projectBuilderConfiguration.getTopLevelProjectFromReactor().getFile());
|
||||
parentDomainModel = new DomainModel( projectBuilderConfiguration.getTopLevelProjectFromReactor().getFile() );
|
||||
}
|
||||
|
||||
if ( !parentDomainModel.matchesParentOf( domainModel ) )
|
||||
|
@ -798,18 +717,19 @@ public class DefaultMavenProjectBuilder
|
|||
domainModels.add( parentDomainModel );
|
||||
if ( domainModel.getParentId() != null )
|
||||
{
|
||||
if(isTop)
|
||||
{
|
||||
if ( isParentLocal( parentDomainModel.getRelativePathOfParent(), parentFile.getParentFile() ) )
|
||||
{
|
||||
domainModels.addAll( getDomainModelParentsFromLocalPath( parentDomainModel, localRepository, remoteRepositories, topProject.getFile().getParentFile(), projectBuilderConfiguration ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
domainModels.addAll( getDomainModelParentsFromRepository( parentDomainModel, localRepository, remoteRepositories ) );
|
||||
}
|
||||
}
|
||||
else if ( isParentLocal( parentDomainModel.getRelativePathOfParent(), parentFile.getParentFile() ) )
|
||||
if ( isTop )
|
||||
{
|
||||
if ( isParentLocal( parentDomainModel.getRelativePathOfParent(), parentFile.getParentFile() ) )
|
||||
{
|
||||
domainModels
|
||||
.addAll( getDomainModelParentsFromLocalPath( parentDomainModel, localRepository, remoteRepositories, topProject.getFile().getParentFile(), projectBuilderConfiguration ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
domainModels.addAll( getDomainModelParentsFromRepository( parentDomainModel, localRepository, remoteRepositories ) );
|
||||
}
|
||||
}
|
||||
else if ( isParentLocal( parentDomainModel.getRelativePathOfParent(), parentFile.getParentFile() ) )
|
||||
{
|
||||
domainModels.addAll( getDomainModelParentsFromLocalPath( parentDomainModel, localRepository, remoteRepositories, parentFile.getParentFile(), projectBuilderConfiguration ) );
|
||||
}
|
||||
|
|
|
@ -1,75 +1,11 @@
|
|||
package org.apache.maven.project;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.maven.artifact.Artifact;
|
||||
import org.apache.maven.artifact.metadata.ArtifactMetadataRetrievalException;
|
||||
import org.apache.maven.artifact.metadata.ResolutionGroup;
|
||||
import org.apache.maven.artifact.repository.ArtifactRepository;
|
||||
import org.apache.maven.model.Model;
|
||||
import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
|
||||
import org.apache.maven.project.artifact.InvalidDependencyVersionException;
|
||||
import org.apache.maven.repository.LegacyRepositorySystem;
|
||||
import org.apache.maven.repository.RepositorySystem;
|
||||
import org.apache.maven.repository.VersionNotFoundException;
|
||||
import org.codehaus.plexus.component.annotations.Component;
|
||||
import org.codehaus.plexus.util.IOUtil;
|
||||
import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
|
||||
|
||||
@Component(role = RepositorySystem.class, hint = "test")
|
||||
public class TestMavenRepositorySystem
|
||||
extends LegacyRepositorySystem
|
||||
{
|
||||
public ResolutionGroup retrieve( Artifact artifact, ArtifactRepository localRepository, List<ArtifactRepository> remoteRepositories )
|
||||
throws ArtifactMetadataRetrievalException
|
||||
{
|
||||
Model model = null;
|
||||
InputStreamReader r = null;
|
||||
try
|
||||
{
|
||||
String scope = artifact.getArtifactId().substring( "scope-".length() );
|
||||
if ( "maven-test".equals( artifact.getGroupId() ) )
|
||||
{
|
||||
String name = "/projects/scope/transitive-" + scope + "-dep.xml";
|
||||
r = new InputStreamReader( getClass().getResourceAsStream( name ) );
|
||||
MavenXpp3Reader reader = new MavenXpp3Reader();
|
||||
model = reader.read( r );
|
||||
}
|
||||
else
|
||||
{
|
||||
model = new Model();
|
||||
}
|
||||
model.setGroupId( artifact.getGroupId() );
|
||||
model.setArtifactId( artifact.getArtifactId() );
|
||||
}
|
||||
catch ( IOException e )
|
||||
{
|
||||
throw new ArtifactMetadataRetrievalException( e );
|
||||
}
|
||||
catch ( XmlPullParserException e )
|
||||
{
|
||||
throw new ArtifactMetadataRetrievalException( e );
|
||||
}
|
||||
finally
|
||||
{
|
||||
IOUtil.close( r );
|
||||
}
|
||||
|
||||
Set artifacts;
|
||||
try
|
||||
{
|
||||
artifacts = createArtifacts( model.getDependencies(), artifact.getScope(), null, null );
|
||||
}
|
||||
catch ( VersionNotFoundException e )
|
||||
{
|
||||
InvalidDependencyVersionException ee = new InvalidDependencyVersionException(e.getProjectId(), e.getDependency(),e.getPomFile(), e.getCauseException() );
|
||||
|
||||
throw new ArtifactMetadataRetrievalException( ee );
|
||||
}
|
||||
|
||||
return new ResolutionGroup( artifact, artifacts, remoteRepositories );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -81,7 +81,7 @@ public class MavenMetadataSourceTest
|
|||
|
||||
MavenProject project = new MavenProject( new Model() );
|
||||
|
||||
Set result = repositorySystem.createArtifacts( deps, null, dependencyFilter, project );
|
||||
Set result = project.createArtifacts( dependencyFilter );
|
||||
|
||||
for ( Iterator it = result.iterator(); it.hasNext(); )
|
||||
{
|
||||
|
@ -96,6 +96,8 @@ public class MavenMetadataSourceTest
|
|||
}
|
||||
}
|
||||
|
||||
//TODO: restore these if it makes sense
|
||||
/*
|
||||
public void testShouldUseCompileScopeIfDependencyScopeEmpty()
|
||||
throws Exception
|
||||
{
|
||||
|
@ -112,9 +114,9 @@ public class MavenMetadataSourceTest
|
|||
|
||||
model.addDependency( dep );
|
||||
|
||||
MavenProject project = new MavenProject( model );
|
||||
MavenProject project = new MavenProject( model, repositorySystem );
|
||||
|
||||
project.setArtifacts( repositorySystem.createArtifacts( project.getDependencies(), null, null, project ) );
|
||||
project.setArtifacts( project.createArtifacts( null ) );
|
||||
|
||||
String key = ArtifactUtils.versionlessKey( groupId, artifactId );
|
||||
|
||||
|
@ -159,13 +161,13 @@ public class MavenMetadataSourceTest
|
|||
|
||||
model.setDependencyManagement( depMgmt );
|
||||
|
||||
MavenProject project = new MavenProject( model );
|
||||
MavenProject project = new MavenProject( model, repositorySystem );
|
||||
|
||||
TestModelDefaultsInjector injector = new TestModelDefaultsInjector();
|
||||
|
||||
injector.injectDefaults( model );
|
||||
|
||||
project.setArtifacts( repositorySystem.createArtifacts( project.getDependencies(), null, null, project ) );
|
||||
|
||||
project.setArtifacts( project.createArtifacts( null ) );
|
||||
|
||||
String key = ArtifactUtils.versionlessKey( groupId, artifactId );
|
||||
|
||||
|
@ -182,5 +184,6 @@ public class MavenMetadataSourceTest
|
|||
//check for back-propagation of default scope.
|
||||
assertEquals( "default scope NOT back-propagated to dependency.", Artifact.SCOPE_TEST, dep.getScope() );
|
||||
}
|
||||
*/
|
||||
|
||||
}
|
||||
|
|
|
@ -49,14 +49,6 @@
|
|||
<groupId>org.apache.maven.wagon</groupId>
|
||||
<artifactId>wagon-http-lightweight</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven.wagon</groupId>
|
||||
<artifactId>wagon-ssh</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven.wagon</groupId>
|
||||
<artifactId>wagon-ssh-external</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven.wagon</groupId>
|
||||
<artifactId>wagon-file</artifactId>
|
||||
|
|
|
@ -38,7 +38,6 @@ import org.apache.maven.lifecycle.LifecycleExecutor;
|
|||
import org.apache.maven.model.Model;
|
||||
import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
|
||||
import org.apache.maven.model.io.xpp3.MavenXpp3Writer;
|
||||
import org.apache.maven.plugin.PluginLoaderException;
|
||||
import org.apache.maven.plugin.PluginManager;
|
||||
import org.apache.maven.project.MavenProject;
|
||||
import org.apache.maven.project.MavenProjectBuilder;
|
||||
|
@ -269,18 +268,6 @@ public class MavenEmbedder
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* mkleint: protected so that IDE integrations can selectively allow downloading artifacts
|
||||
* from remote repositories (if they prohibit by default on project loading)
|
||||
* @throws PluginLoaderException
|
||||
protected void verifyPlugin( Plugin plugin, MavenProject project )
|
||||
throws ComponentLookupException, PluginLoaderException
|
||||
{
|
||||
MavenSession session = new MavenSession( request );
|
||||
pluginManager.loadPlugin( plugin, project, session );
|
||||
}
|
||||
*/
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Project
|
||||
// ----------------------------------------------------------------------
|
||||
|
|
|
@ -90,8 +90,6 @@ public class DefaultMavenExecutionRequestPopulator
|
|||
|
||||
toolchains( request, configuration );
|
||||
|
||||
artifactTransferMechanism( request, configuration );
|
||||
|
||||
profileManager( request, configuration );
|
||||
|
||||
processSettings( request, configuration );
|
||||
|
@ -342,27 +340,6 @@ public class DefaultMavenExecutionRequestPopulator
|
|||
// Artifact Transfer Mechanism
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
private void artifactTransferMechanism( MavenExecutionRequest request, Configuration configuration )
|
||||
throws MavenEmbedderException
|
||||
{
|
||||
// ------------------------------------------------------------------------
|
||||
// Artifact Transfer Mechanism
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
if ( request.isOffline() )
|
||||
{
|
||||
repositorySystem.setOnline( false );
|
||||
}
|
||||
else if ( ( request.getSettings() != null ) && request.getSettings().isOffline() )
|
||||
{
|
||||
repositorySystem.setOnline( false );
|
||||
}
|
||||
else
|
||||
{
|
||||
repositorySystem.setOnline( true );
|
||||
}
|
||||
}
|
||||
|
||||
public ArtifactRepository createLocalRepository( MavenExecutionRequest request, Settings settings, Configuration configuration )
|
||||
throws MavenEmbedderException
|
||||
{
|
||||
|
|
|
@ -39,7 +39,7 @@ public class DomainModel
|
|||
|
||||
protected Model model;
|
||||
|
||||
public Model getModel() throws IOException
|
||||
public Model getModel()
|
||||
{
|
||||
return model;
|
||||
}
|
||||
|
|
|
@ -34,6 +34,7 @@ import org.apache.maven.artifact.repository.ArtifactRepository;
|
|||
import org.apache.maven.artifact.repository.ArtifactRepositoryFactory;
|
||||
import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy;
|
||||
import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
|
||||
import org.apache.maven.artifact.resolver.ArtifactCollector;
|
||||
import org.apache.maven.artifact.resolver.ArtifactResolutionRequest;
|
||||
import org.apache.maven.artifact.resolver.ArtifactResolutionResult;
|
||||
import org.apache.maven.artifact.resolver.ArtifactResolver;
|
||||
|
@ -76,6 +77,9 @@ public class LegacyRepositorySystem
|
|||
@Requirement
|
||||
private ArtifactRepositoryLayout defaultArtifactRepositoryLayout;
|
||||
|
||||
@Requirement
|
||||
private ArtifactCollector artifactCollector;
|
||||
|
||||
@Requirement
|
||||
private MirrorBuilder mirrorBuilder;
|
||||
|
||||
|
@ -157,118 +161,15 @@ public class LegacyRepositorySystem
|
|||
return artifactFactory.createPluginArtifact( plugin.getGroupId(), plugin.getArtifactId(), versionRange );
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@link Set} < {@link Artifact} >
|
||||
* @todo desperately needs refactoring. It's just here because it's implementation is
|
||||
* maven-project specific
|
||||
*/
|
||||
public Set<Artifact> createArtifacts( List<Dependency> dependencies, String inheritedScope, ArtifactFilter dependencyFilter, MavenRepositoryWrapper reactor )
|
||||
throws VersionNotFoundException
|
||||
{
|
||||
return createArtifacts( artifactFactory, dependencies, inheritedScope, dependencyFilter, reactor );
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static Set<Artifact> createArtifacts( ArtifactFactory artifactFactory, List<Dependency> dependencies, String inheritedScope, ArtifactFilter dependencyFilter, MavenRepositoryWrapper reactor )
|
||||
throws VersionNotFoundException
|
||||
{
|
||||
Set<Artifact> projectArtifacts = new LinkedHashSet<Artifact>( dependencies.size() );
|
||||
|
||||
for ( Iterator<Dependency> i = dependencies.iterator(); i.hasNext(); )
|
||||
{
|
||||
Dependency d = i.next();
|
||||
|
||||
String scope = d.getScope();
|
||||
|
||||
if ( StringUtils.isEmpty( scope ) )
|
||||
{
|
||||
scope = Artifact.SCOPE_COMPILE;
|
||||
|
||||
d.setScope( scope );
|
||||
}
|
||||
|
||||
VersionRange versionRange;
|
||||
|
||||
//TODO: how does a poorly specified range turn into a VersionNotFoundException?
|
||||
try
|
||||
{
|
||||
versionRange = VersionRange.createFromVersionSpec( d.getVersion() );
|
||||
}
|
||||
catch ( InvalidVersionSpecificationException e )
|
||||
{
|
||||
throw new VersionNotFoundException( reactor.getId(), d, reactor.getFile(), e );
|
||||
}
|
||||
|
||||
Artifact artifact = artifactFactory.createDependencyArtifact( d.getGroupId(), d.getArtifactId(), versionRange, d.getType(), d.getClassifier(), scope, inheritedScope, d.isOptional() );
|
||||
|
||||
if ( Artifact.SCOPE_SYSTEM.equals( scope ) )
|
||||
{
|
||||
artifact.setFile( new File( d.getSystemPath() ) );
|
||||
}
|
||||
|
||||
ArtifactFilter artifactFilter = dependencyFilter;
|
||||
|
||||
if ( ( artifact != null ) && ( ( artifactFilter == null ) || artifactFilter.include( artifact ) ) )
|
||||
{
|
||||
if ( ( d.getExclusions() != null ) && !d.getExclusions().isEmpty() )
|
||||
{
|
||||
List<String> exclusions = new ArrayList<String>();
|
||||
for ( Iterator<Exclusion> j = d.getExclusions().iterator(); j.hasNext(); )
|
||||
{
|
||||
Exclusion e = j.next();
|
||||
exclusions.add( e.getGroupId() + ":" + e.getArtifactId() );
|
||||
}
|
||||
|
||||
ArtifactFilter newFilter = new ExcludesArtifactFilter( exclusions );
|
||||
|
||||
if ( artifactFilter != null )
|
||||
{
|
||||
AndArtifactFilter filter = new AndArtifactFilter();
|
||||
filter.add( artifactFilter );
|
||||
filter.add( newFilter );
|
||||
artifactFilter = filter;
|
||||
}
|
||||
else
|
||||
{
|
||||
artifactFilter = newFilter;
|
||||
}
|
||||
}
|
||||
|
||||
artifact.setDependencyFilter( artifactFilter );
|
||||
|
||||
if ( reactor != null )
|
||||
{
|
||||
artifact = reactor.find( artifact );
|
||||
}
|
||||
|
||||
projectArtifacts.add( artifact );
|
||||
}
|
||||
}
|
||||
|
||||
return projectArtifacts;
|
||||
}
|
||||
|
||||
public ArtifactRepository buildArtifactRepository( Repository repo )
|
||||
throws InvalidRepositoryException
|
||||
{
|
||||
if ( repo != null )
|
||||
{
|
||||
String id = repo.getId();
|
||||
|
||||
String url = repo.getUrl();
|
||||
/*
|
||||
MNG-4050: Temporarily disabled this check since it is breaking the bootstrap unit tests on commons-parent pom
|
||||
*/
|
||||
/*
|
||||
if ( id == null || id.trim().length() < 1 )
|
||||
{
|
||||
throw new InvalidRepositoryException( "Repository ID must not be empty (URL is: " + url + ").", url );
|
||||
}
|
||||
|
||||
if ( url == null || url.trim().length() < 1 )
|
||||
{
|
||||
throw new InvalidRepositoryException( "Repository URL must not be empty (ID is: " + id + ").", id );
|
||||
}
|
||||
*/
|
||||
|
||||
ArtifactRepositoryPolicy snapshots = buildArtifactRepositoryPolicy( repo.getSnapshots() );
|
||||
|
||||
ArtifactRepositoryPolicy releases = buildArtifactRepositoryPolicy( repo.getReleases() );
|
||||
|
@ -471,6 +372,18 @@ public class LegacyRepositorySystem
|
|||
|
||||
public MetadataResolutionResult resolveMetadata( MetadataResolutionRequest request )
|
||||
{
|
||||
|
||||
// ArtifactResolutionResult collect( Set<Artifact> artifacts,
|
||||
// Artifact originatingArtifact,
|
||||
// Map managedVersions,
|
||||
// ArtifactRepository localRepository,
|
||||
// List<ArtifactRepository> remoteRepositories,
|
||||
// ArtifactMetadataSource source,
|
||||
// ArtifactFilter filter,
|
||||
// List<ResolutionListener> listeners,
|
||||
// List<ConflictResolver> conflictResolvers )
|
||||
|
||||
// ArtifactResolutionResult result = artifactCollector.
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,7 +25,6 @@ import org.apache.maven.artifact.InvalidRepositoryException;
|
|||
import org.apache.maven.artifact.repository.ArtifactRepository;
|
||||
import org.apache.maven.artifact.resolver.ArtifactResolutionRequest;
|
||||
import org.apache.maven.artifact.resolver.ArtifactResolutionResult;
|
||||
import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
|
||||
import org.apache.maven.model.Dependency;
|
||||
import org.apache.maven.model.Plugin;
|
||||
import org.apache.maven.model.Repository;
|
||||
|
@ -57,14 +56,9 @@ public interface RepositorySystem
|
|||
|
||||
Artifact createDependencyArtifact( Dependency dependency );
|
||||
|
||||
//REMOVE
|
||||
// This will disappear when we actually deal with resolving a root dependency and its dependencies. This is used everywhere because of that
|
||||
// deficiency
|
||||
Set<Artifact> createArtifacts( List<Dependency> dependencies, String inheritedScope, ArtifactFilter dependencyFilter, MavenRepositoryWrapper reactor )
|
||||
throws VersionNotFoundException;
|
||||
|
||||
// Repository creation
|
||||
|
||||
//TODO: this needs a project to do anything useful
|
||||
//Set<Artifact> createArtifacts();
|
||||
|
||||
// maven model
|
||||
ArtifactRepository buildArtifactRepository( Repository repository )
|
||||
throws InvalidRepositoryException;
|
||||
|
@ -97,13 +91,7 @@ public interface RepositorySystem
|
|||
* @return
|
||||
*/
|
||||
MetadataResolutionResult resolveMetadata( MetadataResolutionRequest request );
|
||||
|
||||
//REMOVE
|
||||
// Network enablement: this needs to go as we will know at a higher level from the embedder if the system is offline or not, we should not have to
|
||||
// deal with this here.
|
||||
void setOnline( boolean online );
|
||||
boolean isOnline();
|
||||
|
||||
|
||||
//REMOVE
|
||||
// These should be associated with repositories and the repositories should be examine as part of metadatda and
|
||||
// artifact resolution. So these methods should also not be here.
|
||||
|
|
13
pom.xml
13
pom.xml
|
@ -22,13 +22,16 @@ under the License.
|
|||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<!--
|
||||
<parent>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-parent</artifactId>
|
||||
<version>11</version>
|
||||
<relativePath>../pom/maven/pom.xml</relativePath>
|
||||
</parent>
|
||||
-->
|
||||
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven</artifactId>
|
||||
<version>3.0-SNAPSHOT</version>
|
||||
<packaging>pom</packaging>
|
||||
|
@ -294,16 +297,6 @@ under the License.
|
|||
<artifactId>wagon-http-lightweight</artifactId>
|
||||
<version>${wagonVersion}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven.wagon</groupId>
|
||||
<artifactId>wagon-ssh</artifactId>
|
||||
<version>${wagonVersion}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven.wagon</groupId>
|
||||
<artifactId>wagon-ssh-external</artifactId>
|
||||
<version>${wagonVersion}</version>
|
||||
</dependency>
|
||||
<!-- Doxia -->
|
||||
<dependency>
|
||||
<groupId>org.apache.maven.doxia</groupId>
|
||||
|
|
Loading…
Reference in New Issue