本文整理汇总了Java中org.sonatype.aether.artifact.ArtifactType类的典型用法代码示例。如果您正苦于以下问题:Java ArtifactType类的具体用法?Java ArtifactType怎么用?Java ArtifactType使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ArtifactType类属于org.sonatype.aether.artifact包,在下文中一共展示了ArtifactType类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: DefaultArtifact
import org.sonatype.aether.artifact.ArtifactType; //导入依赖的package包/类
/**
* Creates a new artifact with the specified coordinates and properties. Passing {@code null} for any of the
* coordinates is equivalent to specifying an empty string. The optional artifact type provided to this constructor
* will be used to determine the artifact's classifier and file extension if the corresponding arguments for this
* constructor are {@code null}. If the artifact type specifies properties, those will get merged with the
* properties passed directly into the constructor, with the latter properties taking precedence.
*
* @param groupId The group identifier of the artifact, may be {@code null}.
* @param artifactId The artifact identifier of the artifact, may be {@code null}.
* @param classifier The classifier of the artifact, may be {@code null}.
* @param extension The file extension of the artifact, may be {@code null}.
* @param version The version of the artifact, may be {@code null}.
* @param properties The properties of the artifact, may be {@code null} if none.
* @param type The artifact type from which to query classifier, file extension and properties, may be {@code null}.
*/
public DefaultArtifact(String groupId, String artifactId, String classifier, String extension, String version,
Map<String, String> properties, ArtifactType type)
{
this.groupId = emptify(groupId);
this.artifactId = emptify(artifactId);
if (classifier != null || type == null) {
this.classifier = emptify(classifier);
}
else {
this.classifier = emptify(type.getClassifier());
}
if (extension != null || type == null) {
this.extension = emptify(extension);
}
else {
this.extension = emptify(type.getExtension());
}
this.version = emptify(version);
this.file = null;
this.properties = merge(properties, (type != null) ? type.getProperties() : null);
}
示例2: createTypedArtifact
import org.sonatype.aether.artifact.ArtifactType; //导入依赖的package包/类
private Artifact createTypedArtifact(String type, String classifier) {
String extension = type;
ArtifactType stereotype = session.getArtifactTypeRegistry().get(type);
if (stereotype != null) {
extension = stereotype.getExtension();
if (classifier == null) {
classifier = stereotype.getClassifier();
}
}
return new DefaultArtifact(pomArtifact.getGroupId(), pomArtifact.getArtifactId(), classifier, extension, pomArtifact.getVersion());
}
示例3: convert
import org.sonatype.aether.artifact.ArtifactType; //导入依赖的package包/类
private Dependency convert( org.apache.maven.model.Dependency dependency, ArtifactTypeRegistry stereotypes )
{
ArtifactType stereotype = stereotypes.get( dependency.getType() );
if ( stereotype == null )
{
stereotype = new DefaultArtifactType( dependency.getType() );
}
boolean system = dependency.getSystemPath() != null && dependency.getSystemPath().length() > 0;
Map<String, String> props = null;
if ( system )
{
props = Collections.singletonMap( ArtifactProperties.LOCAL_PATH, dependency.getSystemPath() );
}
Artifact artifact =
new DefaultArtifact( dependency.getGroupId(), dependency.getArtifactId(), dependency.getClassifier(), null,
dependency.getVersion(), props, stereotype );
List<Exclusion> exclusions = new ArrayList<Exclusion>( dependency.getExclusions().size() );
for ( org.apache.maven.model.Exclusion exclusion : dependency.getExclusions() )
{
exclusions.add( convert( exclusion ) );
}
Dependency result = new Dependency( artifact, dependency.getScope(), dependency.isOptional(), exclusions );
return result;
}
示例4: toDependency
import org.sonatype.aether.artifact.ArtifactType; //导入依赖的package包/类
public static Dependency toDependency( org.apache.maven.model.Dependency dependency,
ArtifactTypeRegistry stereotypes )
{
ArtifactType stereotype = stereotypes.get( dependency.getType() );
if ( stereotype == null )
{
stereotype = new DefaultArtifactType( dependency.getType() );
}
boolean system = dependency.getSystemPath() != null && dependency.getSystemPath().length() > 0;
Map<String, String> props = null;
if ( system )
{
props = Collections.singletonMap( ArtifactProperties.LOCAL_PATH, dependency.getSystemPath() );
}
Artifact artifact =
new DefaultArtifact( dependency.getGroupId(), dependency.getArtifactId(), dependency.getClassifier(), null,
dependency.getVersion(), props, stereotype );
List<Exclusion> exclusions = new ArrayList<Exclusion>( dependency.getExclusions().size() );
for ( org.apache.maven.model.Exclusion exclusion : dependency.getExclusions() )
{
exclusions.add( toExclusion( exclusion ) );
}
Dependency result = new Dependency( artifact, dependency.getScope(), dependency.isOptional(), exclusions );
return result;
}
示例5: newArtifactType
import org.sonatype.aether.artifact.ArtifactType; //导入依赖的package包/类
public static ArtifactType newArtifactType( String id, ArtifactHandler handler )
{
return new DefaultArtifactType( id, handler.getExtension(), handler.getClassifier(), handler.getLanguage(),
handler.isAddedToClasspath(), handler.isIncludesDependencies() );
}
示例6: get
import org.sonatype.aether.artifact.ArtifactType; //导入依赖的package包/类
public ArtifactType get( String stereotypeId )
{
ArtifactHandler handler = handlerManager.getArtifactHandler( stereotypeId );
return newArtifactType( stereotypeId, handler );
}