本文整理汇总了Java中org.axway.grapes.commons.datamodel.Module.addArtifact方法的典型用法代码示例。如果您正苦于以下问题:Java Module.addArtifact方法的具体用法?Java Module.addArtifact怎么用?Java Module.addArtifact使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.axway.grapes.commons.datamodel.Module
的用法示例。
在下文中一共展示了Module.addArtifact方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getModule
import org.axway.grapes.commons.datamodel.Module; //导入方法依赖的package包/类
/**
* Turn a maven project (Maven data model) into a module (Grapes data model)
*
* @param project MavenProject
* @return Module
*/
public Module getModule(final MavenProject project, final LicenseResolver licenseResolver, final ArtifactResolver artifactResolver) throws MojoExecutionException {
final Module module = GrapesTranslator.getGrapesModule(project);
final List<License> licenses = licenseResolver.resolve(project);
/* Manage Artifacts */
final Artifact mainArtifact = GrapesTranslator.getGrapesArtifact(project.getArtifact());
addLicenses(mainArtifact, licenses);
module.addArtifact(mainArtifact);
// Get pom file if main artifact is not already a pom file
if(!mainArtifact.getType().equals("pom")){
final Artifact pomArtifact = GrapesTranslator.getGrapesArtifact(project.getModel());
addLicenses(pomArtifact, licenses);
module.addArtifact(pomArtifact);
}
for(int i = 0 ; i < project.getAttachedArtifacts().size() ; i++){
artifactResolver.resolveArtifact(project, project.getAttachedArtifacts().get(i));
final Artifact attachedArtifact = GrapesTranslator.getGrapesArtifact(project.getAttachedArtifacts().get(i));
// handle licenses
addLicenses(attachedArtifact, licenses);
module.addArtifact(attachedArtifact);
}
/* Manage Dependencies */
for(int i = 0 ; i < project.getDependencies().size() ; i++){
final Dependency dependency = GrapesTranslator.getGrapesDependency(
artifactResolver.resolveArtifact(project, project.getDependencies().get(i)),
project.getDependencies().get(i).getScope());
// handle licenses
for(License license: licenseResolver.resolve(
project,
dependency.getTarget().getGroupId(),
dependency.getTarget().getArtifactId(),
dependency.getTarget().getVersion())){
dependency.getTarget().addLicense(license.getName());
}
module.addDependency(dependency);
}
return module;
}