本文整理汇总了Java中org.sonatype.aether.artifact.Artifact.getExtension方法的典型用法代码示例。如果您正苦于以下问题:Java Artifact.getExtension方法的具体用法?Java Artifact.getExtension怎么用?Java Artifact.getExtension使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.sonatype.aether.artifact.Artifact
的用法示例。
在下文中一共展示了Artifact.getExtension方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: findArtifact
import org.sonatype.aether.artifact.Artifact; //导入方法依赖的package包/类
public File findArtifact(Artifact artifact) {
String type = artifact.getExtension();
if ("jar".equals(type) && "tests".equals(artifact.getClassifier())) {
type = "test-jar";
}
return MavenModuleMap.getInstance().findArtifact(artifact.getGroupId(), artifact.getArtifactId(), type,
artifact.getBaseVersion());
}
示例2: Key
import org.sonatype.aether.artifact.Artifact; //导入方法依赖的package包/类
public Key( RepositorySystemSession session, VersionRequest request )
{
Artifact artifact = request.getArtifact();
groupId = artifact.getGroupId();
artifactId = artifact.getArtifactId();
classifier = artifact.getClassifier();
extension = artifact.getExtension();
version = artifact.getVersion();
localRepo = session.getLocalRepository().getBasedir();
workspace = CacheUtils.getWorkspace( session );
repositories = new ArrayList<RemoteRepository>( request.getRepositories().size() );
boolean repoMan = false;
for ( RemoteRepository repository : request.getRepositories() )
{
if ( repository.isRepositoryManager() )
{
repoMan = true;
repositories.addAll( repository.getMirroredRepositories() );
}
else
{
repositories.add( repository );
}
}
context = repoMan ? request.getRequestContext() : "";
int hash = 17;
hash = hash * 31 + groupId.hashCode();
hash = hash * 31 + artifactId.hashCode();
hash = hash * 31 + classifier.hashCode();
hash = hash * 31 + extension.hashCode();
hash = hash * 31 + version.hashCode();
hash = hash * 31 + localRepo.hashCode();
hash = hash * 31 + CacheUtils.repositoriesHashCode( repositories );
hashCode = hash;
}
示例3: writeMetadata
import org.sonatype.aether.artifact.Artifact; //导入方法依赖的package包/类
private static void writeMetadata(Artifact a, File repository) {
Versioning v = new Versioning();
// while multiple POMs get downloaded for the same groupId+artifactId,
// there'll be only one jar for each groupId+artifactId, so we just need
// to record that
v.setRelease(a.getVersion());
v.setLatest(a.getVersion());
v.addVersion(a.getVersion());
ArtifactRepositoryMetadata metadata = new ArtifactRepositoryMetadata(
new DefaultArtifact(a.getGroupId(), a.getArtifactId(),
VersionRange.createFromVersion(a.getVersion()),
null, a.getExtension(), null,new DefaultArtifactHandler()),v );
File metadataFile = new File(repository,
a.getGroupId().replace('.', '/')+"/" +
a.getArtifactId() +"/maven-metadata.xml");
MetadataXpp3Writer metadataWriter = new MetadataXpp3Writer();
Writer writer = null;
try {
writer = new FileWriter(metadataFile);
metadataWriter.write(writer, metadata.getMetadata());
} catch (IOException e) {
throw new Error("Error writing artifact metdata.", e);
} finally {
IOUtil.close(writer);
}
}
示例4: findArtifact
import org.sonatype.aether.artifact.Artifact; //导入方法依赖的package包/类
@Override
public File findArtifact(Artifact artifact) {
return super.findArtifact(artifact.getGroupId(), artifact.getArtifactId(), artifact.getBaseVersion(), artifact.getExtension(), artifact.getClassifier());
}
示例5: attachedArtifactComparison
import org.sonatype.aether.artifact.Artifact; //导入方法依赖的package包/类
/**
* Try to satisfy both MNG-4065 and MNG-5214. Consider jar and test-jar equivalent.
* @param requestedType
* @param artifactType
* @return
*/
private boolean attachedArtifactComparison ( Artifact requestedArtifact, org.apache.maven.artifact.Artifact attachedArtifact )
{
if ( ! requestedArtifact.getGroupId().equals ( attachedArtifact.getGroupId() ) )
{
return false;
}
if ( ! requestedArtifact.getArtifactId().equals ( attachedArtifact.getArtifactId() ) )
{
return false;
}
String requestedExtension = requestedArtifact.getExtension();
String attachedExtension = null;
if ( attachedArtifact.getArtifactHandler() != null )
{
attachedExtension = attachedArtifact.getArtifactHandler().getExtension();
}
String requestedType = requestedArtifact.getProperty ( "type", "" );
String attachedType = attachedArtifact.getType();
boolean typeOk = false;
if ( requestedExtension.equals ( attachedExtension ) )
{
// the ideal case.
typeOk = true;
}
else if ( requestedType.equals( attachedType ) )
{
typeOk = true;
}
else if ( JAR_LIKE_TYPES.contains( requestedType ) && JAR_LIKE_TYPES.contains( attachedType ) )
{
typeOk = true;
}
if ( !typeOk )
{
return false;
}
return requestedArtifact.getClassifier().equals ( attachedArtifact.getClassifier() );
}