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

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

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

Artifact.getBaseVersion介绍

[英]Gets the base version of this artifact, for example "1.0-SNAPSHOT". In contrast to the #getVersion(), the base version will always refer to the unresolved meta version.
[中]获取此工件的基本版本,例如“1.0-SNAPSHOT”。与#getVersion()相反,基本版本将始终引用未解析的元版本。

代码示例

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

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

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

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

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

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

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

static String fullArtifactId( final Artifact artifact )
{
  return conflictArtifactId( artifact ) + ":" + artifact.getBaseVersion();
}

代码示例来源:origin: org.sonatype.tycho.p2/p2-publisher

public static String fullArtifactId( final Artifact artifact )
{
  return conflictArtifactId( artifact ) + ":" + artifact.getBaseVersion();
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-maven-embedder

@Override
public List<String> findVersions(org.sonatype.aether.artifact.Artifact artifact) {
  if (silence) {
    return Collections.emptyList();
  }
  //this is important for snapshots, without it the SNAPSHOT will be attempted to be resolved to time-based snapshot version
  for (ArtifactFixer fixer : fixers) {
    File f = fixer.resolve(artifact);
    if (f != null) {
      return Collections.singletonList(artifact.getBaseVersion());
    }
  }
  return Collections.emptyList();
}

代码示例来源: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

public Context( final String featureId, final DependencyNode dependencyTree, final Properties properties )
{
  this.dependencyTree = dependencyTree;
  timestamp = String.format( TIMESTAMP_FORMAT, System.currentTimeMillis() );
  globalNamespace = new HashMap<String, String>();
  globalNamespace.put( "maven:featureId", featureId );
  globalNamespace.put( "maven:featureVersion",
    Utils.toBuildVersion( dependencyTree.getDependency().getArtifact().getBaseVersion(), timestamp ) );
  for ( final Map.Entry<Object, Object> entry : properties.entrySet() )
  {
    globalNamespace.put( "maven:" + (String) entry.getKey(), (String) entry.getValue() );
  }
  units = new HashMap<IUKey, InstallableUnit>();
  markedAsMetaRequirement = new HashSet<IUKey>();
  markedAsTransitiveRequirement = new HashSet<IUKey>();
  processableUnits = new ArrayList<InstallableUnit>();
  processableUnitsNotApplicableToMetaRequirements = new ArrayList<InstallableUnit>();
  installableArtifacts = new ArrayList<InstallableArtifact>();
}

代码示例来源:origin: org.sonatype.tycho.p2/p2-publisher

public 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( 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: sonatype/sonatype-aether

public URI getPath( Artifact artifact )
{
  StringBuilder path = new StringBuilder( 128 );
  path.append( artifact.getGroupId().replace( '.', '/' ) ).append( '/' );
  path.append( artifact.getArtifactId() ).append( '/' );
  path.append( artifact.getBaseVersion() ).append( '/' );
  path.append( artifact.getArtifactId() ).append( '-' ).append( artifact.getVersion() );
  if ( artifact.getClassifier().length() > 0 )
  {
    path.append( '-' ).append( artifact.getClassifier() );
  }
  if ( artifact.getExtension().length() > 0 )
  {
    path.append( '.' ).append( artifact.getExtension() );
  }
  return toUri( path.toString() );
}

代码示例来源: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: sonatype/sonatype-aether

private boolean accept( final Artifact artifact, final String pattern )
{
  final String[] tokens =
    new String[] { artifact.getGroupId(), artifact.getArtifactId(), artifact.getExtension(),
      artifact.getBaseVersion() };
  final String[] patternTokens = pattern.split( ":" );
  // fail immediately if pattern tokens outnumber tokens to match
  boolean matched = ( patternTokens.length <= tokens.length );
  for ( int i = 0; matched && i < patternTokens.length; i++ )
  {
    matched = matches( tokens[i], patternTokens[i] );
  }
  return matched;
}

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

public DependencyTree(DependencyId dependencyId, Dependency dependency, List<DependencyTree> children) {
  this(dependencyId, dependency.getArtifact().getBaseVersion(), children);
  this.scope = dependency.getScope();
  this.optional = dependency.isOptional();
  init(children);
}

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

public DependencyTree(DependencyId dependencyId, Dependency dependency, List<DependencyTree> children) {
  this(dependencyId, dependency.getArtifact().getBaseVersion(), children);
  this.scope = dependency.getScope();
  this.optional = dependency.isOptional();
  init(children);
}

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

/**
 * Creates an artifact identifier of the form
 * {@code <groupId>:<artifactId>:<extension>[:<classifier>]:<baseVersion>}.
 * 
 * @param artifact The artifact to create an identifer for, may be {@code null}.
 * @return The artifact identifier or {@code null} if the input was {@code null}.
 */
public static String toBaseId( Artifact artifact )
{
  String id = null;
  if ( artifact != null )
  {
    id =
      toId( artifact.getGroupId(), artifact.getArtifactId(), artifact.getExtension(),
         artifact.getClassifier(), artifact.getBaseVersion() );
  }
  return id;
}

代码示例来源: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.sonatype.sisu.assembler/sisu-assembler

static void generateInstallableUnitArtifact( final Context context, final InstallableUnit iu,
                           final Artifact artifact )
{
  final InstallableUnitArtifact iuArtifact = new InstallableUnitArtifact();
  iuArtifact.setClassifier( Context.ARTIFACT_CLASSIFIER );
  iuArtifact.setId( Utils.conflictArtifactId( artifact ) );
  iuArtifact.setVersion( Utils.toOsgiVersion( artifact.getBaseVersion(), context.getTimestamp() ) );
  iu.addArtifact( iuArtifact );
}

代码示例来源:origin: org.eclipse.hudson.main/maven3-eventspy-3.0

public static ArtifactDTO convertAetherArtifact(final Artifact artifact) {
    checkNotNull(artifact);
    
    MavenCoordinatesDTO coordinates = new MavenCoordinatesDTO()
      .withGroupId( artifact.getGroupId() )
      .withArtifactId( artifact.getArtifactId() )
      .withType( artifact.getExtension() )
      .withVersion( artifact.getBaseVersion() )
      .withExpandedMetaVersion( artifact.getVersion() )
      .withClassifier( artifact.getClassifier() )
      .normalize();

    String type = artifact.getProperty( "type", "undefined" );
    
    ArtifactDTO artifactDto = new ArtifactDTO()
      .withCoordinates( coordinates )
      .withType( type );

    return artifactDto;
  }
}

代码示例来源:origin: org.jvnet.hudson.main/maven3-eventspy-3.0

public static ArtifactDTO convertAetherArtifact(final Artifact artifact) {
    checkNotNull(artifact);
    
    MavenCoordinatesDTO coordinates = new MavenCoordinatesDTO()
      .withGroupId( artifact.getGroupId() )
      .withArtifactId( artifact.getArtifactId() )
      .withType( artifact.getExtension() )
      .withVersion( artifact.getBaseVersion() )
      .withExpandedMetaVersion( artifact.getVersion() )
      .withClassifier( artifact.getClassifier() )
      .normalize();

    String type = artifact.getProperty( "type", "undefined" );
    
    ArtifactDTO artifactDto = new ArtifactDTO()
      .withCoordinates( coordinates )
      .withType( type );

    return artifactDto;
  }
}

代码示例来源:origin: org.jboss.forge/maven-impl

static Dependency convertToDependency(ResourceFactory factory, DependencyNode node)
{
 org.sonatype.aether.graph.Dependency artifactDependency = node.getDependency();
 Artifact artifact = artifactDependency.getArtifact();
 File file = artifact.getFile();
 @SuppressWarnings("unchecked")
 FileResource<?> artifactResource = factory.create(FileResource.class, file);
 Dependency d = DependencyBuilder.create().setArtifactId(artifact.getArtifactId())
      .setGroupId(artifact.getGroupId()).setVersion(artifact.getBaseVersion())
      .setPackaging(artifact.getExtension()).setArtifact(artifactResource)
      .setOptional(artifactDependency.isOptional())
      .setClassifier(artifact.getClassifier())
      .setScopeType(artifactDependency.getScope());
 return d;
}

相关文章