org.sonatype.aether.artifact.Artifact.getArtifactId()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(7.2k)|赞(0)|评价(0)|浏览(186)

本文整理了Java中org.sonatype.aether.artifact.Artifact.getArtifactId()方法的一些代码示例,展示了Artifact.getArtifactId()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Artifact.getArtifactId()方法的具体详情如下:
包路径:org.sonatype.aether.artifact.Artifact
类名称:Artifact
方法名:getArtifactId

Artifact.getArtifactId介绍

[英]Gets the artifact identifier of this artifact, for example "maven-model".
[中]获取此工件的工件标识符,例如“maven模型”。

代码示例

代码示例来源:origin: apache/zeppelin

private List<File> loadFromMvn(String artifact, Collection<String> excludes)
  throws RepositoryException {
 Collection<String> allExclusions = new LinkedList<>();
 allExclusions.addAll(excludes);
 allExclusions.addAll(Arrays.asList(exclusions));
 List<ArtifactResult> listOfArtifact;
 listOfArtifact = getArtifactsWithDep(artifact, allExclusions);
 Iterator<ArtifactResult> it = listOfArtifact.iterator();
 while (it.hasNext()) {
  Artifact a = it.next().getArtifact();
  String gav = a.getGroupId() + ":" + a.getArtifactId() + ":" + a.getVersion();
  for (String exclude : allExclusions) {
   if (gav.startsWith(exclude)) {
    it.remove();
    break;
   }
  }
 }
 List<File> files = new LinkedList<>();
 for (ArtifactResult artifactResult : listOfArtifact) {
  files.add(artifactResult.getArtifact().getFile());
  logger.debug("load {}", artifactResult.getArtifact().getFile().getAbsolutePath());
 }
 return files;
}

代码示例来源:origin: sonatype/sonatype-aether

public String getArtifactId()
{
  return mainArtifact.getArtifactId();
}

代码示例来源:origin: org.eclipse.proviso/proviso-spi

public String getArtifactId()
{
  return delegate.getArtifactId();
}

代码示例来源:origin: org.sonatype.sisu.assembler/sisu-assembler

static String pathOf( final Artifact artifact )
{
  final StringBuilder path = new StringBuilder( 128 );
  path.append( artifact.getGroupId().replace( '.', '/' ) ).append( '/' );
  path.append( artifact.getArtifactId() ).append( '/' );
  path.append( artifact.getBaseVersion() ).append( '/' );
  path.append( nameOf( artifact ) );
  return path.toString();
}

代码示例来源:origin: org.sonatype.sisu.assembler/sisu-assembler

static String nameOf( final Artifact artifact )
{
  final StringBuilder path = new StringBuilder( 128 );
  path.append( artifact.getArtifactId() ).append( '-' ).append( artifact.getVersion() );
  if ( artifact.getClassifier().length() > 0 )
  {
    path.append( '-' ).append( artifact.getClassifier() );
  }
  path.append( '.' ).append( artifact.getExtension() );
  return path.toString();
}

代码示例来源:origin: org.sonatype.sisu.assembler/sisu-assembler

static String versionlessNameOf( final Artifact artifact )
{
  final StringBuilder path = new StringBuilder( 128 );
  path.append( artifact.getArtifactId() );
  if ( artifact.getClassifier().length() > 0 )
  {
    path.append( '-' ).append( artifact.getClassifier() );
  }
  path.append( '.' ).append( artifact.getExtension() );
  return path.toString();
}

代码示例来源:origin: org.jvnet.hudson/hudson-maven-embedder

private String getConflictId( Artifact artifact )
{
  StringBuilder buffer = new StringBuilder( 128 );
  buffer.append( artifact.getGroupId() );
  buffer.append( ':' ).append( artifact.getArtifactId() );
  buffer.append( ':' ).append( artifact.getExtension() );
  if ( artifact.getClassifier().length() > 0 )
  {
    buffer.append( ':' ).append( artifact.getClassifier() );
  }
  return buffer.toString();
}

代码示例来源:origin: sonatype/sonatype-aether

@Override
public int hashCode()
{
  int hash = 17;
  hash = hash * 31 + artifact.getArtifactId().hashCode();
  hash = hash * 31 + artifact.getGroupId().hashCode();
  hash = hash * 31 + artifact.getClassifier().hashCode();
  hash = hash * 31 + artifact.getExtension().hashCode();
  return hash;
}

代码示例来源:origin: org.apache.maven.mae.components/mae-project-tools

/**
 * {@inheritDoc}
 * 
 * @see org.apache.maven.mae.project.session.ProjectToolsSession#getReactorProject(org.sonatype.aether.artifact.Artifact)
 */
@Override
public MavenProject getReactorProject( final Artifact artifact )
{
  final String id = key( artifact.getGroupId(), artifact.getArtifactId(), artifact.getBaseVersion() );
  return reactorProjects.get( id );
}

代码示例来源:origin: org.jvnet.hudson/hudson-maven-embedder

public File findArtifact( Artifact artifact )
{
  String projectKey = artifact.getGroupId() + ':' + artifact.getArtifactId() + ':' + artifact.getVersion();
  MavenProject project = projectsByGAV.get( projectKey );
  if ( project != null )
  {
    return find( project, artifact );
  }
  return null;
}

代码示例来源:origin: org.sonatype.aether/aether-test-util

public String getPathForLocalArtifact( Artifact artifact )
{
  String artifactId = artifact.getArtifactId();
  String groupId = artifact.getGroupId();
  String extension = artifact.getExtension();
  String version = artifact.getVersion();
  String classifier = artifact.getClassifier();
  String path =
    String.format( "%s/%s/%s/%s-%s-%s%s.%s", groupId, artifactId, version, groupId, artifactId, version,
            classifier, extension );
  return path;
}

代码示例来源:origin: sap-production/xcode-maven-plugin

private DefaultArtifact getSideArtifact(final org.sonatype.aether.artifact.Artifact mainArtifact,
    final String classifier,
    String type)
 {
  return new DefaultArtifact(mainArtifact.getGroupId(), mainArtifact.getArtifactId(), classifier,
     type, mainArtifact.getVersion());
 }
}

代码示例来源:origin: sonatype/sonatype-aether

@Override
public String toString()
{
  return artifact.getGroupId() + ':' + artifact.getArtifactId() + ':' + artifact.getClassifier() + ':'
    + artifact.getExtension();
}

代码示例来源:origin: org.sonatype.aether/aether-impl

private String getId( Artifact a )
{
  return a.getGroupId() + ':' + a.getArtifactId() + ':' + a.getClassifier() + ':' + a.getExtension();
}

代码示例来源:origin: sonatype/sonatype-aether

public String getPathForLocalArtifact( Artifact artifact )
{
  String artifactId = artifact.getArtifactId();
  String groupId = artifact.getGroupId();
  String extension = artifact.getExtension();
  String version = artifact.getVersion();
  String classifier = artifact.getClassifier();
  String path =
    String.format( "%s/%s/%s/%s-%s-%s%s.%s", groupId, artifactId, version, groupId, artifactId, version,
            classifier, extension );
  return path;
}

代码示例来源:origin: io.fabric8.fab/fab-core

@Override
public boolean matches(Dependency dependencyTree) {
  Artifact artifact = dependencyTree.getArtifact();
  String groupId = artifact.getGroupId();
  String artifactId = artifact.getArtifactId();
  return groupFilter.matches(groupId) && artifactFilter.matches(artifactId);
}

代码示例来源:origin: org.fusesource.fabric.fab/fab-core

@Override
public boolean matches(Dependency dependencyTree) {
  Artifact artifact = dependencyTree.getArtifact();
  String groupId = artifact.getGroupId();
  String artifactId = artifact.getArtifactId();
  return groupFilter.matches(groupId) && artifactFilter.matches(artifactId);
}

代码示例来源:origin: io.takari.m2e.workspace/org.eclipse.m2e.workspace.cli

public File findArtifact(org.sonatype.aether.artifact.Artifact artifact) {
 return WorkspaceState2.getInstance().findArtifact(artifact.getGroupId(), artifact.getArtifactId(),
   artifact.getExtension(), artifact.getClassifier(), artifact.getBaseVersion());
}

代码示例来源:origin: org.daisy.pipeline/pax-exam-helper

private MavenBundle(Artifact artifact, boolean forceVersionAsInProject) {
  groupId(artifact.getGroupId());
  artifactId(artifact.getArtifactId());
  type(artifact.getExtension());
  classifier(artifact.getClassifier());
  if (!forceVersionAsInProject)
    version(artifact.getVersion());
}

代码示例来源:origin: com.simpligility.org.apache.maven.shared/maven-dependency-tree

private Artifact getDependencyArtifact( Dependency dep )
{
  org.sonatype.aether.artifact.Artifact artifact = dep.getArtifact();
  return factory.createDependencyArtifact( artifact.getGroupId(), artifact.getArtifactId(),
                       VersionRange.createFromVersion( artifact.getVersion() ),
                       artifact.getProperty( "type", artifact.getExtension() ),
                       artifact.getClassifier(), dep.getScope(), dep.isOptional() );
}

相关文章