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


Java Dependency.getVersion方法代码示例

本文整理汇总了Java中org.apache.maven.model.Dependency.getVersion方法的典型用法代码示例。如果您正苦于以下问题:Java Dependency.getVersion方法的具体用法?Java Dependency.getVersion怎么用?Java Dependency.getVersion使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.maven.model.Dependency的用法示例。


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

示例1: createDependencyFromCoordinates

import org.apache.maven.model.Dependency; //导入方法依赖的package包/类
static Dependency createDependencyFromCoordinates(String coordinatesString, boolean excludeTransitive) {
    final String[] coordinates = coordinatesString.split(":");
    int amountOfCoordinates = coordinates.length;
    if (amountOfCoordinates < 2) {
        throw new IllegalArgumentException(
            "Coordinates of the specified strategy [" + coordinatesString + "] doesn't have the correct format.");
    }
    final Dependency dependency = new Dependency();
    dependency.setGroupId(coordinates[0]);
    dependency.setArtifactId(coordinates[1]);
    if (amountOfCoordinates == 3) {
        dependency.setVersion(coordinates[2]);
    } else if (amountOfCoordinates >= 4) {
        dependency.setType(coordinates[2].isEmpty() ? "jar" : coordinates[2]);
        dependency.setClassifier(coordinates[3]);
    }
    if (amountOfCoordinates >= 5) {
        dependency.setVersion(coordinates[4]);
    }
    if (amountOfCoordinates == 6) {
        dependency.setScope(coordinates[5]);
    }
    if (dependency.getVersion() == null || dependency.getVersion().isEmpty()) {
        dependency.setVersion(ExtensionVersion.version().toString());
    }
    if (excludeTransitive) {
        Exclusion exclusion = new Exclusion();
        exclusion.setGroupId("*");
        exclusion.setArtifactId("*");
        dependency.setExclusions(Arrays.asList(exclusion));
    }
    return dependency;
}
 
开发者ID:arquillian,项目名称:smart-testing,代码行数:34,代码来源:MavenCoordinatesResolver.java

示例2: convertDependencyToJarArtifact

import org.apache.maven.model.Dependency; //导入方法依赖的package包/类
private static Artifact convertDependencyToJarArtifact(Dependency dependency) {
    String groupId = dependency.getGroupId();
    String artifactId = dependency.getArtifactId();
    String version = dependency.getVersion();
    String scope = dependency.getScope();
    String type = dependency.getType();
    String classifier = dependency.getClassifier();
    DefaultArtifact artifact = new DefaultArtifact(groupId, artifactId, version, scope, type, classifier, JAR_ARTIFACT_HANDLER);
    return artifact;
}
 
开发者ID:dmitrykolesnikovich,项目名称:featurea,代码行数:11,代码来源:MavenUtil.java

示例3: toId

import org.apache.maven.model.Dependency; //导入方法依赖的package包/类
private String toId (Dependency dependency) {
	return dependency.getGroupId() + ":" + dependency.getArtifactId() + ":" + dependency.getVersion();
}
 
开发者ID:commsen,项目名称:EM,代码行数:4,代码来源:Dependencies.java

示例4: checkRunTest

import org.apache.maven.model.Dependency; //导入方法依赖的package包/类
static boolean checkRunTest(final RunConfig config) {
    String actionName = config.getActionName();
    if (!(ActionProvider.COMMAND_TEST_SINGLE.equals(actionName) ||
            ActionProvider.COMMAND_DEBUG_TEST_SINGLE.equals(actionName) ||
            ActionProvider.COMMAND_PROFILE_TEST_SINGLE.equals(actionName))) {
        return true;
    }
    if (RunUtils.hasTestCompileOnSaveEnabled(config)) {
        String testng = PluginPropertyUtils.getPluginProperty(config.getMavenProject(), Constants.GROUP_APACHE_PLUGINS,
                Constants.PLUGIN_SUREFIRE, "testNGArtifactName", "test", "testNGArtifactName"); //NOI18N
        if (testng == null) {
            testng = "org.testng:testng"; //NOI18N
        }
        List<Dependency> deps = config.getMavenProject().getTestDependencies();
        boolean haveJUnit = false, haveTestNG = false;
        String testngVersion = null;
        for (Dependency d : deps) {
            if (d.getManagementKey().startsWith(testng)) {
                testngVersion = d.getVersion();
                haveTestNG = true;
            } else if (d.getManagementKey().startsWith("junit:junit")) { //NOI18N
                haveJUnit = true;
            }
        }
        if (haveJUnit && haveTestNG && new ComparableVersion("6.5.1").compareTo(new ComparableVersion(testngVersion)) >= 0) {
            //CoS requires at least TestNG 6.5.2-SNAPSHOT if JUnit is present
            return true;
        }
        String test = config.getProperties().get("test"); //NOI18N
        if (test == null) {
            //user somehow configured mapping in unknown way.
            return true;
        }

        long stamp = CosChecker.getLastCoSLastTouch(config, true);
        //check the COS timestamp against critical files (pom.xml)
        // if changed, don't do COS.
        if (CosChecker.checkImportantFiles(stamp, config)) {
            return true;
        }

        //check the COS timestamp against resources etc.
        //if changed, perform part of the maven build. (or skip COS)
        
        for (CompileOnSaveSkipper skipper : Lookup.getDefault().lookupAll(CompileOnSaveSkipper.class)) {
            if (skipper.skip(config, true, stamp)) {
                return true;
            }
        }
        return OldJavaRunnerCOS.deprecatedJavaRunnerApproachTest(config, actionName);
    } else {
        CosChecker.warnNoTestCoS(config);
        return true;
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:56,代码来源:OldJavaRunnerCOS.java

示例5: checkRunTest

import org.apache.maven.model.Dependency; //导入方法依赖的package包/类
private void checkRunTest(final RunConfig config, ExecutionContext con) {
    String actionName = config.getActionName();
    if (!(ActionProvider.COMMAND_TEST_SINGLE.equals(actionName) ||
            ActionProvider.COMMAND_DEBUG_TEST_SINGLE.equals(actionName) ||
            ActionProvider.COMMAND_PROFILE_TEST_SINGLE.equals(actionName))) {
        return;
    }
    if (RunUtils.isCompileOnSaveEnabled(config)) {
        String testng = PluginPropertyUtils.getPluginProperty(config.getMavenProject(), Constants.GROUP_APACHE_PLUGINS,
                Constants.PLUGIN_SUREFIRE, "testNGArtifactName", "test", "testNGArtifactName"); //NOI18N
        if (testng == null) {
            testng = "org.testng:testng"; //NOI18N
        }
        List<Dependency> deps = config.getMavenProject().getTestDependencies();
        boolean haveJUnit = false, haveTestNG = false;
        String testngVersion = null;
        for (Dependency d : deps) {
            if (d.getManagementKey().startsWith(testng)) {
                testngVersion = d.getVersion();
                haveTestNG = true;
            } else if (d.getManagementKey().startsWith("junit:junit")) { //NOI18N
                haveJUnit = true;
            }
        }
        if (haveJUnit && haveTestNG && new ComparableVersion("6.5.1").compareTo(new ComparableVersion(testngVersion)) >= 0) {
            //CoS requires at least TestNG 6.5.2-SNAPSHOT if JUnit is present
            return;
        }

        long stamp = getLastCoSLastTouch(config, true);
        //check the COS timestamp against critical files (pom.xml)
        // if changed, don't do COS.
        if (checkImportantFiles(stamp, config)) {
            return;
        }

        //check the COS timestamp against resources etc.
        //if changed, perform part of the maven build. (or skip COS)
        
        for (CompileOnSaveSkipper skipper : Lookup.getDefault().lookupAll(CompileOnSaveSkipper.class)) {
            if (skipper.skip(config, true, stamp)) {
                return;
            }
        }
            //now attempt to extract
            if (config instanceof BeanRunConfig) {
                BeanRunConfig brc = (BeanRunConfig) config;
                List<String> processedGoals = new ArrayList<String>();
                for (String goal : brc.getGoals()) {
                    if (Constants.DEFAULT_PHASES.contains(goal) || Constants.CLEAN_PHASES.contains(goal)) {
                        continue;
                    }
                    processedGoals.add(goal);
                }
                if (processedGoals.size() > 0) {
                    brc.setGoals(processedGoals);
                    injectDependencyProjects(brc, true, con);
                }
            } else {
                LOG.log(Level.INFO, "could not strip phase goals from RunConfig subclass {0}", config.getClass().getName());
            }
    } else {
        warnNoTestCoS(config);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:66,代码来源:CosChecker.java

示例6: convert2VInfo

import org.apache.maven.model.Dependency; //导入方法依赖的package包/类
private NBVersionInfo convert2VInfo(Dependency dep) {
    return new NBVersionInfo(null, dep.getGroupId(), dep.getArtifactId(),
            dep.getVersion(), dep.getType(), null, null, null, dep.getClassifier());
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:5,代码来源:AddDependencyPanel.java

示例7: writeDependency

import org.apache.maven.model.Dependency; //导入方法依赖的package包/类
private void writeDependency(Dependency dependency, String tagName, XmlSerializer serializer)
        throws java.io.IOException {
    serializer.startTag(NAMESPACE, tagName);
    flush(serializer);
    StringBuffer b = b(serializer);
    int start = b.length();
    if (dependency.getGroupId() != null) {
        writeValue(serializer, "groupId", dependency.getGroupId(), dependency);
    }
    if (dependency.getArtifactId() != null) {
        writeValue(serializer, "artifactId", dependency.getArtifactId(), dependency);
    }
    if (dependency.getVersion() != null) {
        writeValue(serializer, "version", dependency.getVersion(), dependency);
    }
    if ((dependency.getType() != null) && !dependency.getType().equals("jar")) {
        writeValue(serializer, "type", dependency.getType(), dependency);
    }
    if (dependency.getClassifier() != null) {
        writeValue(serializer, "classifier", dependency.getClassifier(), dependency);
    }
    if (dependency.getScope() != null) {
        writeValue(serializer, "scope", dependency.getScope(), dependency);
    }
    if (dependency.getSystemPath() != null) {
        writeValue(serializer, "systemPath", dependency.getSystemPath(), dependency);
    }
    if ((dependency.getExclusions() != null) && (dependency.getExclusions().size() > 0)) {
        serializer.startTag(NAMESPACE, "exclusions");
        for (Iterator iter = dependency.getExclusions().iterator(); iter.hasNext();) {
            Exclusion o = (Exclusion) iter.next();
            writeExclusion(o, "exclusion", serializer);
        }
        serializer.endTag(NAMESPACE, "exclusions");
    }
    if (dependency.getOptional() != null) {
        writeValue(serializer, "optional", dependency.getOptional(), dependency);
    }
    serializer.endTag(NAMESPACE, tagName).flush();
    logLocation(dependency, "", start, b.length());
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:42,代码来源:LocationAwareMavenXpp3Writer.java

示例8: createProjectDependencyPomModel

import org.apache.maven.model.Dependency; //导入方法依赖的package包/类
private Model createProjectDependencyPomModel(Model processingPomModel) {
    Model templateModel = new Model();
    templateModel.setModelVersion(processingPomModel.getModelVersion());
    templateModel.setGroupId("org.processing.idea");
    templateModel.setArtifactId("core");
    templateModel.setVersion("1.0.0");

    List<Dependency> artifactDependencies = new ArrayList<>(6);

    String joglVersion = null;
    for (Dependency dependency : processingPomModel.getDependencies()) {
        if (dependency.getGroupId().equals("org.jogamp.jogl") && dependency.getArtifactId().equals("jogl")) {
            joglVersion = dependency.getVersion();
        }
    }

    if (joglVersion == null) {
        throw new IllegalStateException("Unable to determine JOGL version used for this build of Processing.");
    }

    Dependency core = new Dependency();
    core.setGroupId("org.processing");
    core.setArtifactId("core");
    core.setVersion(version.toString());
    artifactDependencies.add(core);

    Dependency pdfExport = new Dependency();
    pdfExport.setGroupId(VanillaLibrary.PDF_EXPORT.getGroupId());
    pdfExport.setArtifactId(VanillaLibrary.PDF_EXPORT.getArtifactId());
    pdfExport.setVersion(version.toString());
    artifactDependencies.add(pdfExport);

    Dependency serial = new Dependency();
    serial.setGroupId(VanillaLibrary.SERIAL.getGroupId());
    serial.setArtifactId(VanillaLibrary.SERIAL.getArtifactId());
    serial.setVersion(version.toString());
    artifactDependencies.add(serial);

    Dependency network = new Dependency();
    network.setGroupId(VanillaLibrary.NETWORK.getGroupId());
    network.setArtifactId(VanillaLibrary.NETWORK.getArtifactId());
    network.setVersion(version.toString());
    artifactDependencies.add(network);

    Dependency gluegenRt = new Dependency();
    gluegenRt.setGroupId("org.jogamp.gluegen");
    gluegenRt.setArtifactId("gluegen-rt-main");
    gluegenRt.setVersion(joglVersion);
    artifactDependencies.add(gluegenRt);

    Dependency joglAllMain = new Dependency();
    joglAllMain.setGroupId("org.jogamp.jogl");
    joglAllMain.setArtifactId("jogl-all-main");
    joglAllMain.setVersion(joglVersion);
    artifactDependencies.add(joglAllMain);

    if (SystemInfo.isMac) {
        Dependency appleExtensions = new Dependency();
        appleExtensions.setGroupId("com.apple");
        appleExtensions.setArtifactId("AppleJavaExtensions");
        appleExtensions.setVersion("LATEST");
        artifactDependencies.add(appleExtensions);
    }

    templateModel.setDependencies(artifactDependencies);

    return templateModel;
}
 
开发者ID:mistodev,项目名称:processing-idea,代码行数:69,代码来源:CreateVersionedProcessingPom.java


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