本文整理了Java中org.sonatype.aether.artifact.Artifact.getVersion()
方法的一些代码示例,展示了Artifact.getVersion()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Artifact.getVersion()
方法的具体详情如下:
包路径:org.sonatype.aether.artifact.Artifact
类名称:Artifact
方法名:getVersion
[英]Gets the version of this artifact, for example "1.0-20100529-1213". Note that in case of meta versions like "1.0-SNAPSHOT", the artifact's version depends on the state of the artifact. Artifacts that have been resolved or deployed will have the meta version expanded.
[中]获取此工件的版本,例如“1.0-20100529-1213”。注意,对于像“1.0-SNAPSHOT”这样的元版本,工件的版本取决于工件的状态。已解析或部署的工件将扩展元版本。
代码示例来源: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 getVersion()
{
return delegate.getVersion();
}
代码示例来源:origin: org.eclipse.proviso/proviso-spi
public String getVersion()
{
return delegate.getVersion();
}
代码示例来源:origin: sonatype/sonatype-aether
public String getVersion()
{
return mainArtifact.getVersion();
}
代码示例来源: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.daisy.pipeline/pax-exam-helper
private static String artifactCoords(Artifact artifact) {
String groupId = artifact.getGroupId();
String artifactId = artifact.getArtifactId();
String extension = artifact.getExtension();
String classifier = artifact.getClassifier();
String version = artifact.getVersion();
StringBuilder b = new StringBuilder()
.append(groupId).append(":")
.append(artifactId).append(":");
if (!extension.equals("jar") || !classifier.equals("")) {
b.append(extension).append(":");
if (!classifier.equals(""))
b.append(classifier).append(":"); }
b.append(version);
return b.toString();
}
代码示例来源: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: 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: org.fusesource.fabric.fab/fabric-fab-core
public DependencyTree(DependencyId dependencyId, Dependency dependency, List<DependencyTree> children) {
this(dependencyId, dependency.getArtifact().getVersion(), children);
this.scope = dependency.getScope();
this.optional = dependency.isOptional();
}
代码示例来源: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: org.apache.openejb/openejb-provisionning
public VersionRangeResult resolveVersions(String groupId, String artifactId, String classifier, String extension, String version) {
final RepositorySystemSession session = newSession();
Artifact artifact = new DefaultArtifact(groupId, artifactId, classifier, extension, version);
if (artifact.getVersion().equals("LATEST")) {
artifact = artifact.setVersion(LATEST_VERSION_RANGE);
}
final VersionRangeRequest request = new VersionRangeRequest(artifact, m_remoteRepos, null);
try {
return m_repoSystem.resolveVersionRange(session, request);
} catch (VersionRangeResolutionException e) {
final VersionRangeResult result = new VersionRangeResult(request);
result.setVersions(Arrays.asList((Version) new VersionImpl(version)));
return result;
}
}
代码示例来源:origin: org.eclipse.proviso/proviso-spi
public static String gavOf(Dependency d) {
return d.getArtifact().getGroupId() + ":" + d.getArtifact().getArtifactId() + ":" + d.getArtifact().getVersion();
}
代码示例来源:origin: io.fabric8.fab/fab-core
private boolean isNewer(Artifact a1, Artifact a2) {
if (Objects.equal(a1.getGroupId(), a2.getGroupId()) &&
Objects.equal(a1.getArtifactId(), a2.getArtifactId()) &&
Objects.equal(a1.getExtension(), a2.getExtension()) &&
Objects.equal(a1.getClassifier(), a2.getClassifier())) {
String v1 = a1.getVersion();
String v2 = a2.getVersion();
if (!Objects.equal(v1, v2)) {
int c = v1.compareTo(v2);
return c > 0;
}
}
return false;
}
}
代码示例来源:origin: org.fusesource.fabric.fab/fab-core
private boolean isNewer(Artifact a1, Artifact a2) {
if (Objects.equal(a1.getGroupId(), a2.getGroupId()) &&
Objects.equal(a1.getArtifactId(), a2.getArtifactId()) &&
Objects.equal(a1.getExtension(), a2.getExtension()) &&
Objects.equal(a1.getClassifier(), a2.getClassifier())) {
String v1 = a1.getVersion();
String v2 = a2.getVersion();
if (!Objects.equal(v1, v2)) {
int c = v1.compareTo(v2);
return c > 0;
}
}
return false;
}
}
代码示例来源: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() );
}
代码示例来源:origin: org.jboss.forge/maven-impl
public MavenDependencyAdapter(final org.sonatype.aether.graph.Dependency dep)
{
if (dep == null)
{
throw new IllegalArgumentException("Dependency must not be null.");
}
this.setArtifactId(dep.getArtifact().getArtifactId());
this.setGroupId(dep.getArtifact().getGroupId());
this.setClassifier("".equals(dep.getArtifact().getClassifier()) ? null : dep.getArtifact().getClassifier());
this.setExclusions(dep.getExclusions());
this.setOptional(dep.isOptional());
this.setScope(dep.getScope());
this.setType(dep.getArtifact().getExtension());
this.setVersion(dep.getArtifact().getVersion());
}
代码示例来源:origin: de.smartics.properties/smartics-properties-resource-maven
private static ArtifactRef createArtifact(final DependencyNode node)
{
final Artifact artifact = node.getDependency().getArtifact();
final ArtifactId.Builder builder = new ArtifactId.Builder();
final String classifier = normalize(artifact);
builder.withGroupId(artifact.getGroupId())
.withName(artifact.getArtifactId()).withVersion(artifact.getVersion())
.withArchiveType(artifact.getExtension()).withClassifier(classifier);
final ArtifactId id = builder.build();
final File file = artifact.getFile();
final URL url = toUrl(file);
final ArtifactRef ref = new ArtifactRef(id, url);
return ref;
}
内容来源于网络,如有侵权,请联系作者删除!