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


Java Dependency类代码示例

本文整理汇总了Java中org.axway.grapes.commons.datamodel.Dependency的典型用法代码示例。如果您正苦于以下问题:Java Dependency类的具体用法?Java Dependency怎么用?Java Dependency使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Dependency类属于org.axway.grapes.commons.datamodel包,在下文中一共展示了Dependency类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getLicenses

import org.axway.grapes.commons.datamodel.Dependency; //导入依赖的package包/类
/**
 * Returns the license of a dependency
 *
 * @param dependency Dependency
 * @return String
 */
public String getLicenses(final Dependency dependency){
    final Artifact target = dependency.getTarget();
    final List<String> licensesList = target.getLicenses();

    final StringBuilder sb = new StringBuilder();

    if(licensesList != null){
        Collections.sort(licensesList);
        for(String license : licensesList){
            sb.append(license);
            sb.append( " " );
        }
    }

    return sb.toString();
}
 
开发者ID:Axway,项目名称:grapes-jenkins-plugin,代码行数:23,代码来源:GrapesBuildAction.java

示例2: GrapesBuildAction

import org.axway.grapes.commons.datamodel.Dependency; //导入依赖的package包/类
/**
 * Initiate the report
 *
 * @param module Module
 * @param grapesClient GrapesClient
 */
public GrapesBuildAction(final Module module, final GrapesClient grapesClient) {
   if(grapesClient == null ||
            module == null ){
        return;
    }

    title = "Dependency  report of " + module.getName() + " in version " + module.getVersion();

    // Init the report with Grapes server information
    try{
        final Organization organization = grapesClient.getModuleOrganization(module.getName(), module.getVersion());
        final List<String> corporateFilters = organization.getCorporateGroupIdPrefixes();
        dependencies = new HashMap<Dependency, String>();

        final List<Dependency> moduleDependencies = ModuleUtils.getCorporateDependencies(module, corporateFilters);
        for(Dependency dependency: moduleDependencies){
            final String lastVersion = getLastVersion(grapesClient, dependency);
            this.dependencies.put(dependency, lastVersion);
        }

        thirdParty = ModuleUtils.getThirdPartyLibraries(module, corporateFilters);
        ancestors = grapesClient.getModuleAncestors(module.getName(), module.getVersion());

        initOk = true;

    } catch (Exception e){
        GrapesPlugin.getLogger().log(Level.WARNING, "Failed to generate build dependency report for " + module.getName(), e);
    }

}
 
开发者ID:Axway,项目名称:grapes-jenkins-plugin,代码行数:37,代码来源:GrapesBuildAction.java

示例3: getLastVersion

import org.axway.grapes.commons.datamodel.Dependency; //导入依赖的package包/类
/**
 * Returns the last version of a dependency
 *
 *
 * @param grapesClient
 * @param dependency Dependency
 * @return String
 */
public String getLastVersion(final GrapesClient grapesClient, final Dependency dependency){
    final Logger logger = LogManager.getLogManager().getLogger("hudson.WebAppMain");
    try{
        final Artifact target = dependency.getTarget();
        return grapesClient.getArtifactLastVersion(target.getGavc());
    } catch (GrapesCommunicationException e) {
        logger.info("Failed to get last version of : " + dependency.getTarget().getGavc());
    }
     return "";
}
 
开发者ID:Axway,项目名称:grapes-jenkins-plugin,代码行数:19,代码来源:GrapesBuildAction.java

示例4: generateDependency

import org.axway.grapes.commons.datamodel.Dependency; //导入依赖的package包/类
@Test
public void generateDependency() throws MojoExecutionException {
    final String groupId = "org.axway.grapes.test" ;
    final String artifactId = "artifactId" ;
    final String version = "1.0.0" ;
    final String classifier = "linux" ;
    final String type = "test-jar" ;
    final String extension = "jar" ;
    final String scope = "TEST" ;

    final DefaultArtifactHandler handler = new DefaultArtifactHandler();
    handler.setExtension(extension);

    final org.apache.maven.artifact.Artifact mavenArtifact = new DefaultArtifact(
            groupId,
            artifactId,
            version,
            "COMPILE",
            type,
            classifier ,
            handler);

    final Dependency dependency = GrapesTranslator.getGrapesDependency(mavenArtifact, scope);
    assertEquals(groupId, dependency.getTarget().getGroupId());
    assertEquals(artifactId, dependency.getTarget().getArtifactId());
    assertEquals(classifier, dependency.getTarget().getClassifier());
    assertEquals(version, dependency.getTarget().getVersion());
    assertEquals(type, dependency.getTarget().getType());
    assertEquals(extension, dependency.getTarget().getExtension());
    assertEquals(scope, dependency.getScope().toString());

}
 
开发者ID:Axway,项目名称:grapes-maven-plugin,代码行数:33,代码来源:GrapesTranslatorTest.java

示例5: getCorporateDependencies

import org.axway.grapes.commons.datamodel.Dependency; //导入依赖的package包/类
public Map<Dependency, String> getCorporateDependencies(){
    return dependencies;
}
 
开发者ID:Axway,项目名称:grapes-jenkins-plugin,代码行数:4,代码来源:GrapesBuildAction.java

示例6: getAncestors

import org.axway.grapes.commons.datamodel.Dependency; //导入依赖的package包/类
public List<Dependency> getAncestors(){
    return ancestors;
}
 
开发者ID:Axway,项目名称:grapes-jenkins-plugin,代码行数:4,代码来源:GrapesBuildAction.java

示例7: getThirdPartyLibraries

import org.axway.grapes.commons.datamodel.Dependency; //导入依赖的package包/类
public List<Dependency> getThirdPartyLibraries(){
    return thirdParty;
}
 
开发者ID:Axway,项目名称:grapes-jenkins-plugin,代码行数:4,代码来源:GrapesBuildAction.java

示例8: getModule

import org.axway.grapes.commons.datamodel.Dependency; //导入依赖的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;
}
 
开发者ID:Axway,项目名称:grapes-maven-plugin,代码行数:52,代码来源:ModuleBuilder.java


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