当前位置: 首页>>代码示例>>Java>>正文


Java ArtifactFactory.createArtifact方法代码示例

本文整理汇总了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;
}
 
开发者ID:wso2,项目名称:maven-tools,代码行数:34,代码来源:MavenUtils.java

示例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" );
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:5,代码来源:Signature.java

示例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*/ );
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:5,代码来源:Signature.java

示例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;
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:46,代码来源:DefaultArtifactCollectorTest.java


注:本文中的org.apache.maven.artifact.factory.ArtifactFactory.createArtifact方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。