Skip to content
This repository has been archived by the owner on Jan 29, 2020. It is now read-only.

Commit

Permalink
upgraded parent pom
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.apache.org/repos/asf/maven/shared/trunk@1635388 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
hboutemy committed Oct 30, 2014
1 parent b9a009b commit 1be1bfe
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 21 deletions.
2 changes: 1 addition & 1 deletion maven-artifact-resolver/pom.xml
Expand Up @@ -25,7 +25,7 @@ under the License.
<parent>
<artifactId>maven-shared-components</artifactId>
<groupId>org.apache.maven.shared</groupId>
<version>20</version>
<version>21</version>
<relativePath>../maven-shared-components/pom.xml</relativePath>
</parent>

Expand Down
Expand Up @@ -23,7 +23,6 @@
import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
import org.apache.maven.artifact.resolver.ArtifactResolutionException;
import org.apache.maven.execution.MavenSession;
import org.apache.maven.model.Dependency;
import org.apache.maven.project.MavenProject;

import java.util.Collection;
Expand All @@ -47,11 +46,11 @@ public interface ProjectDependenciesResolver
* @param session Contains the local repository, along with other settings related to artifact resolution.
* @return The set of resolved artifacts. If the projects contain no dependencies, this will return an empty set.
* @throws ArtifactResolutionException In case {@link Artifact} instances cannot be created from
* project {@link Dependency} instances, or artifact resolution fails.
* project {@link org.apache.maven.model.Dependency} instances, or artifact resolution fails.
* @throws ArtifactNotFoundException In cases where one or more dependency artifacts cannot be found in the
* various repositories.
*/
public Set<Artifact> resolve( Collection<? extends MavenProject> projects, Collection<String> scopes,
Set<Artifact> resolve( Collection<? extends MavenProject> projects, Collection<String> scopes,
MavenSession session )
throws ArtifactResolutionException, ArtifactNotFoundException;

Expand All @@ -64,10 +63,10 @@ public Set<Artifact> resolve( Collection<? extends MavenProject> projects, Colle
* @param session Contains the local repository, along with other settings related to artifact resolution.
* @return The set of resolved artifacts. If the project contains no dependencies, this will return an empty set.
* @throws ArtifactResolutionException In case {@link Artifact} instances cannot be created from the
* project {@link Dependency} instance, or artifact resolution fails.
* project {@link org.apache.maven.model.Dependency} instance, or artifact resolution fails.
* @throws ArtifactNotFoundException In cases where one or more dependency artifacts cannot be found in the
* various repositories.
*/
public Set<Artifact> resolve( MavenProject project, Collection<String> scopes, MavenSession session )
Set<Artifact> resolve( MavenProject project, Collection<String> scopes, MavenSession session )
throws ArtifactResolutionException, ArtifactNotFoundException;
}
Expand Up @@ -23,13 +23,12 @@

import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
import org.apache.maven.artifact.resolver.filter.ScopeArtifactFilter;

/**
* Filter to only retain objects in the given scope or better. This implementation allows the
* accumulation of multiple scopes and their associated implied scopes, so that the user can filter
* apply a series of implication rules in a single step. This should be a more efficient implementation
* of multiple standard {@link ScopeArtifactFilter} instances ORed together.
* of multiple standard {@link org.apache.maven.artifact.resolver.filter.ScopeArtifactFilter} instances ORed together.
*
* @author <a href="mailto:brett@apache.org">Brett Porter</a>
* @author jdcasey
Expand Down
Expand Up @@ -69,11 +69,13 @@ public final class DefaultProjectDependenciesResolver
private ArtifactMetadataSource metadataSource;

// for plexus instantiation.
public DefaultProjectDependenciesResolver(){}
public DefaultProjectDependenciesResolver()
{
}

// for testing.
DefaultProjectDependenciesResolver( ArtifactResolver resolver, ArtifactFactory artifactFactory,
ArtifactMetadataSource metadataSource )
ArtifactMetadataSource metadataSource )
{
this.resolver = resolver;
this.artifactFactory = artifactFactory;
Expand All @@ -97,19 +99,19 @@ public Set<Artifact> resolve( final Collection<? extends MavenProject> projects,

CumulativeScopeArtifactFilter scopeFilter = new CumulativeScopeArtifactFilter( scopes );

for ( MavenProject project : projects )
for ( MavenProject proj : projects )
{
Set<Artifact> depArtifacts = project.getDependencyArtifacts();
Set<Artifact> depArtifacts = proj.getDependencyArtifacts();
if ( depArtifacts == null )
{
try
{
depArtifacts = project.createArtifacts( artifactFactory, null, scopeFilter );
depArtifacts = proj.createArtifacts( artifactFactory, null, scopeFilter );
}
catch ( InvalidDependencyVersionException e )
{
throw new ArtifactResolutionException( "Failed to create Artifact instances for project dependencies: "
+ e.getMessage(), null, e );
throw new ArtifactResolutionException( "Failed to create Artifact instances for project "
+ "dependencies: " + e.getMessage(), null, e );
}
}

Expand All @@ -128,19 +130,19 @@ public Set<Artifact> resolve( final Collection<? extends MavenProject> projects,
}
}

Artifact projectArtifact = project.getArtifact();
Artifact projectArtifact = proj.getArtifact();
if ( projectArtifact == null )
{
projectArtifact = artifactFactory.createProjectArtifact( project.getGroupId(), project.getArtifactId(),
project.getVersion() );
projectArtifact = artifactFactory.createProjectArtifact( proj.getGroupId(), proj.getArtifactId(),
proj.getVersion() );
}

try
{
ArtifactResolutionResult result = resolver.resolveTransitively( depArtifacts, projectArtifact,
project.getManagedVersionMap(),
proj.getManagedVersionMap(),
session.getLocalRepository(),
project.getRemoteArtifactRepositories(),
proj.getRemoteArtifactRepositories(),
metadataSource, scopeFilter );

if ( result.getArtifacts() != null && !result.getArtifacts().isEmpty() )
Expand Down Expand Up @@ -179,7 +181,8 @@ public Set<Artifact> resolve( final Collection<? extends MavenProject> projects,
/**
* {@inheritDoc}
*/
public Set<Artifact> resolve( final MavenProject project, final Collection<String> scopes, final MavenSession session )
public Set<Artifact> resolve( final MavenProject project, final Collection<String> scopes,
final MavenSession session )
throws ArtifactResolutionException, ArtifactNotFoundException
{
Collection<MavenProject> projects = Collections.singleton( project );
Expand Down

0 comments on commit 1be1bfe

Please sign in to comment.