本文整理汇总了Java中org.apache.maven.artifact.ArtifactUtils.key方法的典型用法代码示例。如果您正苦于以下问题:Java ArtifactUtils.key方法的具体用法?Java ArtifactUtils.key怎么用?Java ArtifactUtils.key使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.maven.artifact.ArtifactUtils
的用法示例。
在下文中一共展示了ArtifactUtils.key方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: toDescriptor
import org.apache.maven.artifact.ArtifactUtils; //导入方法依赖的package包/类
/**
* Converts the given artifact to a string of the form <code>groupId:artifactId:version:[type]:[classifier]</code>.
* @param artifact the artifact to encode as an artifact descriptor.
* @return the artifact descriptor, as a string.
*/
public static String toDescriptor(final Artifact artifact) {
Preconditions.checkNotNull(artifact);
final String artifactId = artifact.getArtifactId();
final String groupId = artifact.getGroupId();
final String type = artifact.getType();
final String version = artifact.getVersion();
final String classifier = artifact.getClassifier();
final StringBuilder builder = new StringBuilder(ArtifactUtils.key(
groupId, artifactId, version));
if (!StringUtils.isBlank(type)) {
builder.append(ARTIFACT_DESCRIPTOR_SEPARATOR + type);
if (!StringUtils.isBlank(classifier)) {
builder.append(ARTIFACT_DESCRIPTOR_SEPARATOR + classifier);
}
}
final String artifactDescription = builder.toString();
return artifactDescription;
}
示例2: SimpleReactorReader
import org.apache.maven.artifact.ArtifactUtils; //导入方法依赖的package包/类
private SimpleReactorReader(Collection<MavenProject> projects, Collection<Artifact> artifacts) {
repository = new WorkspaceRepository("reactor", new Object());
Map<String, MavenProject> projectsByGAV = new LinkedHashMap<>();
for (MavenProject project : projects) {
String projectKey = ArtifactUtils.key(project.getGroupId(), project.getArtifactId(), project.getVersion());
projectsByGAV.put(projectKey, project);
}
this.projectsByGAV = ImmutableMap.copyOf(projectsByGAV);
Map<String, Artifact> artifactsByGAVCE = new LinkedHashMap<>();
for (Artifact artifact : artifacts) {
artifactsByGAVCE.put(keyGAVCE(artifact), artifact);
}
this.artifactsByGAVCE = ImmutableMap.copyOf(artifactsByGAVCE);
}
示例3: areAllDependenciesInReactor
import org.apache.maven.artifact.ArtifactUtils; //导入方法依赖的package包/类
private boolean areAllDependenciesInReactor( Collection<MavenProject> projects, Collection<Dependency> dependencies )
{
Set<String> projectKeys = getReactorProjectKeys( projects );
for ( Dependency dependency : dependencies )
{
org.sonatype.aether.artifact.Artifact a = dependency.getArtifact();
String key = ArtifactUtils.key( a.getGroupId(), a.getArtifactId(), a.getVersion() );
if ( !projectKeys.contains( key ) )
{
return false;
}
}
return true;
}
示例4: findDependency
import org.apache.maven.artifact.ArtifactUtils; //导入方法依赖的package包/类
private static Artifact findDependency( MavenProject project, Artifact upStreamArtifact )
{
if ( upStreamArtifact == null || isThreadLockedAndEmpty(upStreamArtifact))
{
return null;
}
String key = ArtifactUtils.key( upStreamArtifact.getGroupId(), upStreamArtifact.getArtifactId(),
upStreamArtifact.getVersion() );
final Set<Artifact> deps = project.getDependencyArtifacts();
for ( Artifact dep : deps )
{
String depKey = ArtifactUtils.key( dep.getGroupId(), dep.getArtifactId(), dep.getVersion() );
if ( key.equals( depKey ) )
{
return dep;
}
}
return null;
}
示例5: findArtifact
import org.apache.maven.artifact.ArtifactUtils; //导入方法依赖的package包/类
public File findArtifact( Artifact artifact )
{
String projectKey = ArtifactUtils.key( artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion() );
MavenProject project = projectsByGAV.get( projectKey );
if ( project != null )
{
File file = find( project, artifact );
if ( file == null && project != project.getExecutionProject() )
{
file = find( project.getExecutionProject(), artifact );
}
return file;
}
return null;
}
示例6: getReactorProjectKeys
import org.apache.maven.artifact.ArtifactUtils; //导入方法依赖的package包/类
private Set<String> getReactorProjectKeys( Collection<MavenProject> projects )
{
Set<String> projectKeys = new HashSet<String>( projects.size() * 2 );
for ( MavenProject project : projects )
{
String key = ArtifactUtils.key( project.getGroupId(), project.getArtifactId(), project.getVersion() );
projectKeys.add( key );
}
return projectKeys;
}
示例7: ReactorDependencyFilter
import org.apache.maven.artifact.ArtifactUtils; //导入方法依赖的package包/类
public ReactorDependencyFilter( Collection<Artifact> artifacts )
{
for ( Artifact artifact : artifacts )
{
String key = ArtifactUtils.key( artifact );
keys.add( key );
}
}
示例8: accept
import org.apache.maven.artifact.ArtifactUtils; //导入方法依赖的package包/类
public boolean accept( DependencyNode node, List<DependencyNode> parents )
{
Dependency dependency = node.getDependency();
if ( dependency != null )
{
org.sonatype.aether.artifact.Artifact a = dependency.getArtifact();
String key = ArtifactUtils.key( a.getGroupId(), a.getArtifactId(), a.getVersion() );
return !keys.contains( key );
}
return false;
}
示例9: getReactorProjectKeys
import org.apache.maven.artifact.ArtifactUtils; //导入方法依赖的package包/类
public Set<String> getReactorProjectKeys()
{
Set<String> projectKeys = new HashSet<String>( items.size() * 2 );
for ( ProjectSegment projectBuild : items )
{
MavenProject project = projectBuild.getProject();
String key = ArtifactUtils.key( project.getGroupId(), project.getArtifactId(), project.getVersion() );
projectKeys.add( key );
}
return projectKeys;
}
示例10: getIgnorableArtifacts
import org.apache.maven.artifact.ArtifactUtils; //导入方法依赖的package包/类
private Set<String> getIgnorableArtifacts( Collection<? extends MavenProject> projects )
{
Set<String> projectIds = new HashSet<String>( projects.size() * 2 );
for ( MavenProject p : projects )
{
String key = ArtifactUtils.key( p.getGroupId(), p.getArtifactId(), p.getVersion() );
projectIds.add( key );
}
return projectIds;
}
示例11: getProjectMap
import org.apache.maven.artifact.ArtifactUtils; //导入方法依赖的package包/类
private Map<String, MavenProject> getProjectMap( Collection<MavenProject> projects )
throws DuplicateProjectException
{
Map<String, MavenProject> index = new LinkedHashMap<String, MavenProject>();
Map<String, List<File>> collisions = new LinkedHashMap<String, List<File>>();
for ( MavenProject project : projects )
{
String projectId = ArtifactUtils.key( project.getGroupId(), project.getArtifactId(), project.getVersion() );
MavenProject collision = index.get( projectId );
if ( collision == null )
{
index.put( projectId, project );
}
else
{
List<File> pomFiles = collisions.get( projectId );
if ( pomFiles == null )
{
pomFiles = new ArrayList<File>( Arrays.asList( collision.getFile(), project.getFile() ) );
collisions.put( projectId, pomFiles );
}
else
{
pomFiles.add( project.getFile() );
}
}
}
if ( !collisions.isEmpty() )
{
throw new DuplicateProjectException( "Two or more projects in the reactor"
+ " have the same identifier, please make sure that <groupId>:<artifactId>:<version>"
+ " is unique for each project: " + collisions, collisions );
}
return index;
}
示例12: getProject
import org.apache.maven.artifact.ArtifactUtils; //导入方法依赖的package包/类
private MavenProject getProject(Artifact artifact) {
String projectKey = ArtifactUtils.key(artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion());
MavenProject project = projectsByGAV.get(projectKey);
return project;
}
示例13: getId
import org.apache.maven.artifact.ArtifactUtils; //导入方法依赖的package包/类
public static String getId( MavenProject project )
{
return ArtifactUtils.key( project.getGroupId(), project.getArtifactId(), project.getVersion() );
}
示例14: getProjectMap
import org.apache.maven.artifact.ArtifactUtils; //导入方法依赖的package包/类
private Map<String, MavenProject> getProjectMap( List<MavenProject> projects )
throws org.apache.maven.DuplicateProjectException
{
Map<String, MavenProject> index = new LinkedHashMap<String, MavenProject>();
Map<String, List<File>> collisions = new LinkedHashMap<String, List<File>>();
for ( MavenProject project : projects )
{
String projectId = ArtifactUtils.key( project.getGroupId(), project.getArtifactId(), project.getVersion() );
MavenProject collision = index.get( projectId );
if ( collision == null )
{
index.put( projectId, project );
}
else
{
List<File> pomFiles = collisions.get( projectId );
if ( pomFiles == null )
{
pomFiles = new ArrayList<File>( Arrays.asList( collision.getFile(), project.getFile() ) );
collisions.put( projectId, pomFiles );
}
else
{
pomFiles.add( project.getFile() );
}
}
}
if ( !collisions.isEmpty() )
{
throw new org.apache.maven.DuplicateProjectException( "Two or more projects in the reactor"
+ " have the same identifier, please make sure that <groupId>:<artifactId>:<version>"
+ " is unique for each project: " + collisions, collisions );
}
return index;
}