本文整理汇总了Java中org.apache.maven.artifact.factory.ArtifactFactory.createArtifact方法的典型用法代码示例。如果您正苦于以下问题:Java ArtifactFactory.createArtifact方法的具体用法?Java ArtifactFactory.createArtifact怎么用?Java ArtifactFactory.createArtifact使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.maven.artifact.factory.ArtifactFactory
的用法示例。
在下文中一共展示了ArtifactFactory.createArtifact方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getResolvedArtifact
import org.apache.maven.artifact.factory.ArtifactFactory; //导入方法依赖的package包/类
/**
* Resolve a maven artifact from specified repositories and the system path
*
* @param groupId
* @param artifactId
* @param version
* @param type
* @param scope
* @param file
* @param artifactFactory
* @param remoteRepositories
* @param localRepository
* @param resolver
* @return resolved artifact
* @throws MojoExecutionException
*/
public static Artifact getResolvedArtifact(String groupId, String artifactId, String version, String type,
String scope, File file, ArtifactFactory artifactFactory, List<?> remoteRepositories,
ArtifactRepository localRepository, ArtifactResolver resolver) throws MojoExecutionException {
Artifact artifact = artifactFactory.createArtifact(groupId, artifactId, version, scope, type);
if (null != file) {
artifact.setFile(file);
}
try {
resolver.resolve(artifact, remoteRepositories, localRepository);
} catch (ArtifactResolutionException | ArtifactNotFoundException e) {
throw new MojoExecutionException("Failed to resolve dependency in system path or specified repositories.",
e);
}
return artifact;
}
示例2: createArtifact
import org.apache.maven.artifact.factory.ArtifactFactory; //导入方法依赖的package包/类
public org.apache.maven.artifact.Artifact createArtifact( ArtifactFactory factory )
{
return factory.createArtifact( groupId, artifactId, version, null, "signature" );
}
示例3: createArtifact
import org.apache.maven.artifact.factory.ArtifactFactory; //导入方法依赖的package包/类
public org.apache.maven.artifact.Artifact createArtifact( ArtifactFactory factory )
{
return factory.createArtifact( groupId, artifactId, version, null, "signature"/*don't really care*/ );
}
示例4: createArtifacts
import org.apache.maven.artifact.factory.ArtifactFactory; //导入方法依赖的package包/类
private Set createArtifacts( ArtifactFactory artifactFactory, Set dependencies, String inheritedScope,
ArtifactFilter dependencyFilter )
throws InvalidVersionSpecificationException
{
Set projectArtifacts = new HashSet();
for ( Iterator i = dependencies.iterator(); i.hasNext(); )
{
Artifact d = (Artifact) i.next();
VersionRange versionRange;
if ( d.getVersionRange() != null )
{
versionRange = d.getVersionRange();
}
else
{
versionRange = VersionRange.createFromVersionSpec( d.getVersion() );
}
Artifact artifact;
if ( d.getScope().equals( Artifact.SCOPE_TEST ) || d.getScope().equals( Artifact.SCOPE_PROVIDED ) )
{
/* don't call createDependencyArtifact as it'll ignore test and provided scopes */
artifact =
artifactFactory.createArtifact( d.getGroupId(), d.getArtifactId(), d.getVersion(),
d.getScope(), d.getType() );
}
else
{
artifact =
artifactFactory.createDependencyArtifact( d.getGroupId(), d.getArtifactId(), versionRange,
d.getType(), d.getClassifier(), d.getScope(),
inheritedScope, d.isOptional() );
}
if ( artifact != null && ( dependencyFilter == null || dependencyFilter.include( artifact ) ) )
{
artifact.setDependencyFilter( dependencyFilter );
projectArtifacts.add( artifact );
}
}
return projectArtifacts;
}