mirror of https://github.com/apache/maven.git
PR: MNG-649
add classifier to dependency. it becomes part of the dependency key along with type when not null git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@225524 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
3fb0852fdf
commit
eedd050414
|
@ -42,10 +42,10 @@ public interface ArtifactFactory
|
|||
String classifier );
|
||||
|
||||
Artifact createDependencyArtifact( String groupId, String artifactId, VersionRange versionRange, String type,
|
||||
String scope );
|
||||
String classifier, String scope );
|
||||
|
||||
Artifact createDependencyArtifact( String groupId, String artifactId, VersionRange versionRange, String type,
|
||||
String scope, String inheritedScope );
|
||||
String classifier, String scope, String inheritedScope );
|
||||
|
||||
Artifact createBuildArtifact( String groupId, String artifactId, String version, String packaging );
|
||||
|
||||
|
|
|
@ -50,15 +50,15 @@ public class DefaultArtifactFactory
|
|||
}
|
||||
|
||||
public Artifact createDependencyArtifact( String groupId, String artifactId, VersionRange versionRange, String type,
|
||||
String scope )
|
||||
String classifier, String scope )
|
||||
{
|
||||
return createArtifact( groupId, artifactId, versionRange, null, type, null, null );
|
||||
return createArtifact( groupId, artifactId, versionRange, null, type, classifier, null );
|
||||
}
|
||||
|
||||
public Artifact createDependencyArtifact( String groupId, String artifactId, VersionRange versionRange, String type,
|
||||
String scope, String inheritedScope )
|
||||
String classifier, String scope, String inheritedScope )
|
||||
{
|
||||
return createArtifact( groupId, artifactId, versionRange, scope, type, null, inheritedScope );
|
||||
return createArtifact( groupId, artifactId, versionRange, scope, type, classifier, inheritedScope );
|
||||
}
|
||||
|
||||
public Artifact createBuildArtifact( String groupId, String artifactId, String version, String packaging )
|
||||
|
|
|
@ -419,8 +419,10 @@ public class DefaultArtifactCollectorTest
|
|||
ArtifactSpec a = (ArtifactSpec) artifacts.get( key );
|
||||
try
|
||||
{
|
||||
return new ResolutionGroup( artifact, createArtifacts( artifactFactory, a.dependencies, artifact.getScope(),
|
||||
artifact.getDependencyFilter() ), Collections.EMPTY_LIST );
|
||||
return new ResolutionGroup( artifact, createArtifacts( artifactFactory, a.dependencies,
|
||||
artifact.getScope(),
|
||||
artifact.getDependencyFilter() ),
|
||||
Collections.EMPTY_LIST );
|
||||
}
|
||||
catch ( InvalidVersionSpecificationException e )
|
||||
{
|
||||
|
@ -445,7 +447,8 @@ public class DefaultArtifactCollectorTest
|
|||
|
||||
VersionRange versionRange = VersionRange.createFromVersionSpec( d.getVersion() );
|
||||
Artifact artifact = artifactFactory.createDependencyArtifact( d.getGroupId(), d.getArtifactId(),
|
||||
versionRange, d.getType(), d.getScope(),
|
||||
versionRange, d.getType(),
|
||||
d.getClassifier(), d.getScope(),
|
||||
inheritedScope );
|
||||
|
||||
if ( artifact != null && ( dependencyFilter == null || dependencyFilter.include( artifact ) ) )
|
||||
|
|
|
@ -1210,6 +1210,16 @@
|
|||
<type>String</type>
|
||||
<defaultValue>jar</defaultValue>
|
||||
</field>
|
||||
<field>
|
||||
<name>classifier</name>
|
||||
<version>4.0.0</version>
|
||||
<description>
|
||||
The classifier of the dependency. This allows distinguishing two artifacts that belong to the same POM but
|
||||
were built differently, and is appended to the filename after the version.
|
||||
</description>
|
||||
<type>String</type>
|
||||
<required>false</required>
|
||||
</field>
|
||||
<field>
|
||||
<name>properties</name>
|
||||
<version>3.0.0</version>
|
||||
|
@ -1266,14 +1276,9 @@
|
|||
<codeSegment>
|
||||
<version>4.0.0</version>
|
||||
<code><![CDATA[
|
||||
public String getId()
|
||||
{
|
||||
return groupId + ":" + artifactId + ":" + type + ":" + version;
|
||||
}
|
||||
|
||||
public String getManagementKey()
|
||||
{
|
||||
return groupId + ":" + artifactId + ":" + type;
|
||||
return groupId + ":" + artifactId + ":" + type + classifier != null ? ":" + classifier : "";
|
||||
}
|
||||
]]></code>
|
||||
</codeSegment>
|
||||
|
|
|
@ -74,21 +74,21 @@ public class PrepareReleaseMojo
|
|||
* @readonly
|
||||
*/
|
||||
private boolean interactive = true;
|
||||
|
||||
|
||||
/**
|
||||
* @parameter expression="${component.org.apache.maven.artifact.metadata.ArtifactMetadataSource}"
|
||||
* @required
|
||||
* @readonly
|
||||
*/
|
||||
private ArtifactMetadataSource artifactMetadataSource;
|
||||
|
||||
|
||||
/**
|
||||
* @parameter expression="${component.org.codehaus.plexus.components.inputhandler.InputHandler}"
|
||||
* @required
|
||||
* @readonly
|
||||
*/
|
||||
private InputHandler inputHandler;
|
||||
|
||||
|
||||
/**
|
||||
* @parameter expression="${localRepository}"
|
||||
* @required
|
||||
|
@ -122,23 +122,24 @@ public class PrepareReleaseMojo
|
|||
checkForPresenceOfSnapshots();
|
||||
|
||||
transformPomToReleaseVersionPom();
|
||||
|
||||
|
||||
generateReleasePropertiesFile();
|
||||
|
||||
|
||||
generateReleasePom();
|
||||
|
||||
|
||||
checkInReleaseVersionPom();
|
||||
|
||||
tagRelease();
|
||||
|
||||
transformPomToSnapshotVersionPom();
|
||||
|
||||
|
||||
new File( basedir, RELEASE_POM ).delete();
|
||||
|
||||
checkInSnapshotVersionPom();
|
||||
}
|
||||
|
||||
private void generateReleasePropertiesFile() throws MojoExecutionException
|
||||
private void generateReleasePropertiesFile()
|
||||
throws MojoExecutionException
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -349,29 +350,30 @@ public class PrepareReleaseMojo
|
|||
if ( project.hasParent() )
|
||||
{
|
||||
Artifact parentArtifact = project.getParentArtifact();
|
||||
|
||||
|
||||
if ( isSnapshot( parentArtifact.getBaseVersion() ) )
|
||||
{
|
||||
String version = resolveVersion( parentArtifact, "parent" );
|
||||
|
||||
|
||||
model.getParent().setVersion( version );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//Rewrite dependencies section
|
||||
Map artifactMap = ArtifactUtils.artifactMapByArtifactId( project.getArtifacts() );
|
||||
|
||||
|
||||
for ( Iterator i = model.getDependencies().iterator(); i.hasNext(); )
|
||||
{
|
||||
Dependency dep = (Dependency) i.next();
|
||||
|
||||
String conflictId = ArtifactUtils.artifactId( dep.getGroupId(), dep.getArtifactId(), dep.getType(), dep.getVersion() );
|
||||
|
||||
|
||||
String conflictId = ArtifactUtils.artifactId( dep.getGroupId(), dep.getArtifactId(), dep.getType(),
|
||||
dep.getClassifier(), dep.getVersion() );
|
||||
|
||||
Artifact artifact = (Artifact) artifactMap.get( conflictId );
|
||||
|
||||
|
||||
dep.setVersion( artifact.getVersion() );
|
||||
}
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
PomTransformer transformer = new VersionTransformer();
|
||||
|
@ -391,43 +393,45 @@ public class PrepareReleaseMojo
|
|||
throw new MojoExecutionException( "Can't transform pom to its release version form.", e );
|
||||
}
|
||||
}
|
||||
|
||||
private void generateReleasePom() throws MojoExecutionException
|
||||
|
||||
private void generateReleasePom()
|
||||
throws MojoExecutionException
|
||||
{
|
||||
MavenProject releaseProject = new MavenProject( project );
|
||||
Model releaseModel = releaseProject.getModel();
|
||||
|
||||
|
||||
//Rewrite parent version
|
||||
if ( project.hasParent() )
|
||||
{
|
||||
Artifact parentArtifact = project.getParentArtifact();
|
||||
|
||||
|
||||
if ( isSnapshot( parentArtifact.getBaseVersion() ) )
|
||||
{
|
||||
String version = resolveVersion( parentArtifact, "parent" );
|
||||
|
||||
|
||||
model.getParent().setVersion( version );
|
||||
}
|
||||
}
|
||||
|
||||
//Rewrite dependencies section
|
||||
List newdeps = new ArrayList();
|
||||
|
||||
|
||||
for ( Iterator i = releaseProject.getArtifacts().iterator(); i.hasNext(); )
|
||||
{
|
||||
Artifact artifact = (Artifact) i.next();
|
||||
|
||||
|
||||
Dependency newdep = new Dependency();
|
||||
|
||||
|
||||
newdep.setArtifactId( artifact.getArtifactId() );
|
||||
newdep.setGroupId( artifact.getGroupId() );
|
||||
newdep.setVersion( artifact.getVersion() );
|
||||
newdep.setType( artifact.getType() );
|
||||
newdep.setScope( artifact.getScope() );
|
||||
|
||||
newdep.setClassifier( artifact.getClassifier() );
|
||||
|
||||
newdeps.add( newdep );
|
||||
}
|
||||
|
||||
|
||||
releaseModel.setDependencies( newdeps );
|
||||
|
||||
//Rewrite plugins version
|
||||
|
@ -439,17 +443,17 @@ public class PrepareReleaseMojo
|
|||
for ( Iterator j = releaseModel.getBuild().getPlugins().iterator(); j.hasNext(); )
|
||||
{
|
||||
Plugin plugin = (Plugin) j.next();
|
||||
if ( ArtifactUtils.versionlessKey(artifact).equals( plugin.getKey() ) )
|
||||
if ( ArtifactUtils.versionlessKey( artifact ).equals( plugin.getKey() ) )
|
||||
{
|
||||
String version = resolveVersion( artifact, "plugin" );
|
||||
|
||||
|
||||
plugin.setGroupId( artifact.getGroupId() );
|
||||
plugin.setVersion( version );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//Rewrite report version
|
||||
for ( Iterator i = releaseProject.getReportArtifacts().iterator(); i.hasNext(); )
|
||||
{
|
||||
|
@ -457,16 +461,16 @@ public class PrepareReleaseMojo
|
|||
if ( isSnapshot( artifact.getBaseVersion() ) )
|
||||
{
|
||||
List reportPlugins = releaseProject.getReportPlugins();
|
||||
|
||||
|
||||
if ( reportPlugins != null )
|
||||
{
|
||||
for ( Iterator j = reportPlugins.iterator(); j.hasNext(); )
|
||||
{
|
||||
ReportPlugin plugin = (ReportPlugin) j.next();
|
||||
if ( ArtifactUtils.versionlessKey(artifact).equals( plugin.getKey() ) )
|
||||
if ( ArtifactUtils.versionlessKey( artifact ).equals( plugin.getKey() ) )
|
||||
{
|
||||
String version = resolveVersion( artifact, "report" );
|
||||
|
||||
|
||||
plugin.setGroupId( artifact.getGroupId() );
|
||||
plugin.setVersion( version );
|
||||
}
|
||||
|
@ -474,15 +478,15 @@ public class PrepareReleaseMojo
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
File releasePomFile = new File( basedir, RELEASE_POM );
|
||||
|
||||
|
||||
Writer writer = null;
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
writer = new FileWriter( releasePomFile );
|
||||
|
||||
|
||||
releaseProject.writeModel( writer );
|
||||
}
|
||||
catch ( IOException e )
|
||||
|
@ -493,7 +497,7 @@ public class PrepareReleaseMojo
|
|||
{
|
||||
IOUtil.close( writer );
|
||||
}
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
ScmBean scm = getScm();
|
||||
|
@ -501,11 +505,11 @@ public class PrepareReleaseMojo
|
|||
scm.setWorkingDirectory( basedir );
|
||||
|
||||
List scmChanges = scm.getStatus();
|
||||
|
||||
|
||||
for ( Iterator i = scmChanges.iterator(); i.hasNext(); )
|
||||
{
|
||||
ScmFile f = (ScmFile) i.next();
|
||||
|
||||
|
||||
if ( f.getPath().equals( "release-pom.xml" ) && f.getStatus() != ScmFileStatus.MODIFIED )
|
||||
{
|
||||
getScm().add( RELEASE_POM );
|
||||
|
@ -522,21 +526,21 @@ public class PrepareReleaseMojo
|
|||
}
|
||||
}
|
||||
|
||||
private String resolveVersion( Artifact artifact, String artifactUsage )
|
||||
private String resolveVersion( Artifact artifact, String artifactUsage )
|
||||
throws MojoExecutionException
|
||||
{
|
||||
if ( artifact.getFile() == null )
|
||||
{
|
||||
try
|
||||
{
|
||||
artifactMetadataSource.retrieve(artifact, localRepository, project.getPluginArtifactRepositories() );
|
||||
artifactMetadataSource.retrieve( artifact, localRepository, project.getPluginArtifactRepositories() );
|
||||
}
|
||||
catch ( ArtifactMetadataRetrievalException e )
|
||||
{
|
||||
throw new MojoExecutionException( "Cannot resolve " + artifactUsage + ": " + artifact.getId(), e );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return artifact.getVersion();
|
||||
}
|
||||
|
||||
|
|
|
@ -83,6 +83,8 @@ public class VersionTransformer
|
|||
|
||||
Node type = node.selectSingleNode( "type" );
|
||||
|
||||
Node classifier = node.selectSingleNode( "classifier" );
|
||||
|
||||
String typeText = "jar";
|
||||
|
||||
if ( type != null )
|
||||
|
@ -91,7 +93,8 @@ public class VersionTransformer
|
|||
}
|
||||
Node version = node.selectSingleNode( "version" );
|
||||
|
||||
String versionText = getDependency( groupId.getText(), artifactId.getText(), typeText ).getVersion();
|
||||
String versionText = getDependency( groupId.getText(), artifactId.getText(), typeText,
|
||||
classifier.getText() ).getVersion();
|
||||
if ( version != null )
|
||||
{
|
||||
version.setText( versionText );
|
||||
|
@ -183,14 +186,16 @@ public class VersionTransformer
|
|||
}
|
||||
}
|
||||
|
||||
private Dependency getDependency( String groupId, String artifactId, String type )
|
||||
private Dependency getDependency( String groupId, String artifactId, String type, String classifier )
|
||||
{
|
||||
// TODO: equals() in Dependency would be better
|
||||
for ( Iterator i = getUpdatedModel().getDependencies().iterator(); i.hasNext(); )
|
||||
{
|
||||
Dependency dependency = (Dependency) i.next();
|
||||
|
||||
if ( dependency.getGroupId().equals( groupId ) && dependency.getArtifactId().equals( artifactId ) &&
|
||||
dependency.getType().equals( type ) )
|
||||
dependency.getType().equals( type ) && dependency.getClassifier() != null
|
||||
? dependency.getClassifier().equals( classifier ) : classifier == null )
|
||||
{
|
||||
return dependency;
|
||||
}
|
||||
|
|
|
@ -86,7 +86,7 @@ public class DefaultMavenProjectBuilder
|
|||
private PlexusContainer container;
|
||||
|
||||
protected ArtifactResolver artifactResolver;
|
||||
|
||||
|
||||
protected ArtifactMetadataSource artifactMetadataSource;
|
||||
|
||||
private ArtifactFactory artifactFactory;
|
||||
|
@ -94,7 +94,7 @@ public class DefaultMavenProjectBuilder
|
|||
private ModelInheritanceAssembler modelInheritanceAssembler;
|
||||
|
||||
private ModelValidator validator;
|
||||
|
||||
|
||||
// TODO: make it a component
|
||||
private MavenXpp3Reader modelReader;
|
||||
|
||||
|
@ -146,12 +146,13 @@ public class DefaultMavenProjectBuilder
|
|||
Artifact projectArtifact = project.getArtifact();
|
||||
|
||||
Map managedVersions = createManagedVersionMap( project.getDependencyManagement() );
|
||||
|
||||
|
||||
ensureMetadataSourceIsInitialized();
|
||||
|
||||
try
|
||||
{
|
||||
project.setDependencyArtifacts( MavenProject.createArtifacts( artifactFactory, project.getDependencies() ) );
|
||||
project.setDependencyArtifacts(
|
||||
MavenProject.createArtifacts( artifactFactory, project.getDependencies() ) );
|
||||
}
|
||||
catch ( InvalidVersionSpecificationException e )
|
||||
{
|
||||
|
@ -166,8 +167,8 @@ public class DefaultMavenProjectBuilder
|
|||
project.setArtifacts( result.getArtifacts() );
|
||||
return project;
|
||||
}
|
||||
|
||||
private void ensureMetadataSourceIsInitialized()
|
||||
|
||||
private void ensureMetadataSourceIsInitialized()
|
||||
throws ProjectBuildingException
|
||||
{
|
||||
if ( artifactMetadataSource == null )
|
||||
|
@ -199,7 +200,7 @@ public class DefaultMavenProjectBuilder
|
|||
VersionRange versionRange = VersionRange.createFromVersionSpec( d.getVersion() );
|
||||
Artifact artifact = artifactFactory.createDependencyArtifact( d.getGroupId(), d.getArtifactId(),
|
||||
versionRange, d.getType(),
|
||||
d.getScope() );
|
||||
d.getClassifier(), d.getScope() );
|
||||
map.put( d.getManagementKey(), artifact );
|
||||
}
|
||||
catch ( InvalidVersionSpecificationException e )
|
||||
|
@ -231,7 +232,8 @@ public class DefaultMavenProjectBuilder
|
|||
modelCache.put( createCacheKey( model.getGroupId(), model.getArtifactId(), model.getVersion() ), model );
|
||||
|
||||
MavenProject project = build( projectDescriptor.getAbsolutePath(), model, localRepository,
|
||||
Collections.EMPTY_LIST, externalProfiles, projectDescriptor.getAbsoluteFile().getParentFile() );
|
||||
Collections.EMPTY_LIST, externalProfiles,
|
||||
projectDescriptor.getAbsoluteFile().getParentFile() );
|
||||
|
||||
// Only translate the base directory for files in the source tree
|
||||
pathTranslator.alignToBaseDirectory( project.getModel(), projectDescriptor );
|
||||
|
@ -345,10 +347,11 @@ public class DefaultMavenProjectBuilder
|
|||
}
|
||||
|
||||
Model originalModel = ModelUtils.cloneModel( model );
|
||||
|
||||
|
||||
List repositories = new ArrayList( aggregatedRemoteWagonRepositories );
|
||||
|
||||
MavenProject project = assembleLineage( model, lineage, repositories, localRepository, externalProfiles, projectDir );
|
||||
|
||||
MavenProject project = assembleLineage( model, lineage, repositories, localRepository, externalProfiles,
|
||||
projectDir );
|
||||
|
||||
project.setOriginalModel( originalModel );
|
||||
|
||||
|
@ -479,7 +482,9 @@ public class DefaultMavenProjectBuilder
|
|||
return project;
|
||||
}
|
||||
|
||||
/** @noinspection CollectionDeclaredAsConcreteClass*/
|
||||
/**
|
||||
* @noinspection CollectionDeclaredAsConcreteClass
|
||||
*/
|
||||
private MavenProject assembleLineage( Model model, LinkedList lineage, List aggregatedRemoteWagonRepositories,
|
||||
ArtifactRepository localRepository, List externalProfiles, File projectDir )
|
||||
throws ProjectBuildingException
|
||||
|
@ -520,20 +525,20 @@ public class DefaultMavenProjectBuilder
|
|||
{
|
||||
throw new ProjectBuildingException( "Missing version element from parent element" );
|
||||
}
|
||||
|
||||
|
||||
model = getCachedModel( parentModel.getGroupId(), parentModel.getArtifactId(), parentModel.getVersion() );
|
||||
|
||||
|
||||
// the only way this will have a value is if we find the parent on disk...
|
||||
File parentProjectDir = null;
|
||||
|
||||
|
||||
String parentRelativePath = parentModel.getRelativePath();
|
||||
|
||||
|
||||
// if we can't find a cached model matching the parent spec, then let's try to look on disk using
|
||||
// <relativePath/>
|
||||
if ( model == null && projectDir != null && StringUtils.isNotEmpty(parentRelativePath) )
|
||||
if ( model == null && projectDir != null && StringUtils.isNotEmpty( parentRelativePath ) )
|
||||
{
|
||||
File parentDescriptor = new File( projectDir, parentRelativePath );
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
parentDescriptor = parentDescriptor.getCanonicalFile();
|
||||
|
@ -541,34 +546,37 @@ public class DefaultMavenProjectBuilder
|
|||
catch ( IOException e )
|
||||
{
|
||||
getLogger().debug( "Failed to canonicalize potential parent POM: \'" + parentDescriptor + "\'", e );
|
||||
|
||||
|
||||
parentDescriptor = null;
|
||||
}
|
||||
|
||||
|
||||
if ( parentDescriptor != null && parentDescriptor.exists() )
|
||||
{
|
||||
Model candidateParent = readModel( parentDescriptor );
|
||||
|
||||
|
||||
// this works because parent-version is still required...
|
||||
if ( parentModel.getGroupId().equals( candidateParent.getGroupId() )
|
||||
&& parentModel.getArtifactId().equals( candidateParent.getArtifactId() )
|
||||
&& ( parentModel.getVersion().equals( candidateParent.getVersion() )
|
||||
|| ( candidateParent.getParent() != null
|
||||
&& parentModel.getVersion().equals(candidateParent.getParent().getVersion() ) ) ) )
|
||||
if ( parentModel.getGroupId().equals( candidateParent.getGroupId() ) &&
|
||||
parentModel.getArtifactId().equals( candidateParent.getArtifactId() ) && (
|
||||
parentModel.getVersion().equals( candidateParent.getVersion() ) || (
|
||||
candidateParent.getParent() != null &&
|
||||
parentModel.getVersion().equals( candidateParent.getParent().getVersion() ) ) ) )
|
||||
{
|
||||
model = candidateParent;
|
||||
|
||||
|
||||
parentProjectDir = parentDescriptor.getParentFile();
|
||||
|
||||
getLogger().debug( "Using parent-POM from the project hierarchy at: \'" + parentModel.getRelativePath() + "\' for project: " + project.getId() );
|
||||
|
||||
getLogger().debug( "Using parent-POM from the project hierarchy at: \'" +
|
||||
parentModel.getRelativePath() + "\' for project: " + project.getId() );
|
||||
}
|
||||
else
|
||||
{
|
||||
getLogger().debug("Invalid parent-POM referenced by relative path: \'" + parentModel.getRelativePath() + "\'. It did not match parent specification in " + project.getId() );
|
||||
getLogger().debug( "Invalid parent-POM referenced by relative path: \'" +
|
||||
parentModel.getRelativePath() + "\'. It did not match parent specification in " +
|
||||
project.getId() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Artifact parentArtifact = null;
|
||||
|
||||
// only resolve the parent model from the repository system if we didn't find it on disk...
|
||||
|
@ -590,7 +598,8 @@ public class DefaultMavenProjectBuilder
|
|||
model = findModelFromRepository( parentArtifact, aggregatedRemoteWagonRepositories, localRepository );
|
||||
}
|
||||
|
||||
MavenProject parent = assembleLineage( model, lineage, aggregatedRemoteWagonRepositories, localRepository, externalProfiles, parentProjectDir );
|
||||
MavenProject parent = assembleLineage( model, lineage, aggregatedRemoteWagonRepositories, localRepository,
|
||||
externalProfiles, parentProjectDir );
|
||||
|
||||
project.setParent( parent );
|
||||
|
||||
|
@ -704,10 +713,10 @@ public class DefaultMavenProjectBuilder
|
|||
}
|
||||
|
||||
protected Set createReportArtifacts( List reports )
|
||||
throws ProjectBuildingException
|
||||
throws ProjectBuildingException
|
||||
{
|
||||
Set pluginArtifacts = new HashSet();
|
||||
|
||||
|
||||
if ( reports != null )
|
||||
{
|
||||
for ( Iterator i = reports.iterator(); i.hasNext(); )
|
||||
|
|
|
@ -19,9 +19,9 @@ package org.apache.maven.project;
|
|||
import org.apache.maven.artifact.Artifact;
|
||||
import org.apache.maven.artifact.ArtifactUtils;
|
||||
import org.apache.maven.artifact.DependencyResolutionRequiredException;
|
||||
import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException;
|
||||
import org.apache.maven.artifact.factory.ArtifactFactory;
|
||||
import org.apache.maven.artifact.repository.ArtifactRepository;
|
||||
import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException;
|
||||
import org.apache.maven.model.Build;
|
||||
import org.apache.maven.model.CiManagement;
|
||||
import org.apache.maven.model.Contributor;
|
||||
|
@ -387,6 +387,7 @@ public class MavenProject
|
|||
dependency.setVersion( a.getVersion() );
|
||||
dependency.setScope( a.getScope() );
|
||||
dependency.setType( a.getType() );
|
||||
dependency.setClassifier( a.getClassifier() );
|
||||
|
||||
list.add( dependency );
|
||||
}
|
||||
|
@ -471,6 +472,7 @@ public class MavenProject
|
|||
dependency.setVersion( a.getVersion() );
|
||||
dependency.setScope( a.getScope() );
|
||||
dependency.setType( a.getType() );
|
||||
dependency.setClassifier( a.getClassifier() );
|
||||
|
||||
list.add( dependency );
|
||||
}
|
||||
|
@ -552,6 +554,7 @@ public class MavenProject
|
|||
dependency.setVersion( a.getVersion() );
|
||||
dependency.setScope( a.getScope() );
|
||||
dependency.setType( a.getType() );
|
||||
dependency.setClassifier( a.getClassifier() );
|
||||
|
||||
list.add( dependency );
|
||||
}
|
||||
|
|
|
@ -49,9 +49,9 @@ public class MavenMetadataSource
|
|||
extends AbstractLogEnabled
|
||||
implements ArtifactMetadataSource
|
||||
{
|
||||
|
||||
|
||||
public static final String ROLE_HINT = "maven";
|
||||
|
||||
|
||||
private MavenProjectBuilder mavenProjectBuilder;
|
||||
|
||||
private ArtifactFactory artifactFactory;
|
||||
|
@ -150,8 +150,8 @@ public class MavenMetadataSource
|
|||
|
||||
VersionRange versionRange = VersionRange.createFromVersionSpec( d.getVersion() );
|
||||
Artifact artifact = artifactFactory.createDependencyArtifact( d.getGroupId(), d.getArtifactId(),
|
||||
versionRange, d.getType(), d.getScope(),
|
||||
inheritedScope );
|
||||
versionRange, d.getType(), d.getClassifier(),
|
||||
d.getScope(), inheritedScope );
|
||||
|
||||
if ( artifact != null && ( dependencyFilter == null || dependencyFilter.include( artifact ) ) )
|
||||
{
|
||||
|
|
|
@ -53,7 +53,7 @@ public class TestArtifactResolver
|
|||
implements Contextualizable
|
||||
{
|
||||
public static final String ROLE = TestArtifactResolver.class.getName();
|
||||
|
||||
|
||||
private ArtifactRepositoryFactory repositoryFactory;
|
||||
|
||||
private PlexusContainer container;
|
||||
|
@ -146,7 +146,8 @@ public class TestArtifactResolver
|
|||
|
||||
VersionRange versionRange = VersionRange.createFromVersionSpec( d.getVersion() );
|
||||
Artifact artifact = artifactFactory.createDependencyArtifact( d.getGroupId(), d.getArtifactId(),
|
||||
versionRange, d.getType(), d.getScope(),
|
||||
versionRange, d.getType(),
|
||||
d.getClassifier(), d.getScope(),
|
||||
inheritedScope );
|
||||
if ( artifact != null )
|
||||
{
|
||||
|
@ -157,7 +158,7 @@ public class TestArtifactResolver
|
|||
return projectArtifacts;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public Source source()
|
||||
{
|
||||
return new Source( artifactFactory, repositoryFactory, container );
|
||||
|
|
Loading…
Reference in New Issue