當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。