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


Java Dependency.getVersion方法代码示例

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


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

示例1: checkModelDependency

import org.netbeans.modules.maven.model.pom.Dependency; //导入方法依赖的package包/类
public static Dependency checkModelDependency(POMModel pom, String groupId, String artifactId, boolean add) {
    Project mdl = pom.getProject();
    Dependency ret = mdl.findDependencyById(groupId, artifactId, null);
    Dependency managed = null;
    if (ret == null || ret.getVersion() == null) {
        //check dependency management section as well..
        DependencyManagement mng = mdl.getDependencyManagement();
        if (mng != null) {
            managed = mng.findDependencyById(groupId, artifactId, null);
        }
    }
    if (add && ret == null) {
        ret = mdl.getModel().getFactory().createDependency();
        ret.setGroupId(groupId);
        ret.setArtifactId(artifactId);
        mdl.addDependency(ret);
    }
    // if managed dependency section is present, return that one for editing..
    return managed == null ? ret : managed;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:21,代码来源:ModelUtils.java

示例2: checkDependencyList

import org.netbeans.modules.maven.model.pom.Dependency; //导入方法依赖的package包/类
private void checkDependencyList(List<Dependency> deps, final POMModel model, List<ErrorDescription> toRet, Map<String, String> managed) {
    if (deps != null) {
        for (final Dependency dep : deps) {
            String ver = dep.getVersion();
            if (ver != null) {
                String art = dep.getArtifactId();
                String gr = dep.getGroupId();
                String key = gr + ":" + art; //NOI18N
                if (managed.keySet().contains(key)) {
                    final String managedver = managed.get(key);
                    Document doc = model.getBaseDocument();
                    final Line[] line = new Line[1];
                    doc.render(new Runnable() {
                        @Override
                        public void run() {
                            int position = dep.findChildElementPosition(model.getPOMQNames().VERSION.getQName());
                            line[0] = NbEditorUtilities.getLine(model.getBaseDocument(), position, false);
                        }
                    });
                    toRet.add(ErrorDescriptionFactory.createErrorDescription(
                        configuration.getSeverity(configuration.getPreferences()).toEditorSeverity(),
                        NbBundle.getMessage(OverrideDependencyManagementError.class, "TXT_OverrideDependencyManagementError", managedver),
                        Collections.<Fix>singletonList(new OverrideFix(dep)),
                        doc, line[0].getLineNumber() + 1));
                }
            }
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:30,代码来源:OverrideDependencyManagementError.java

示例3: extractSelectedDeps

import org.netbeans.modules.maven.model.pom.Dependency; //导入方法依赖的package包/类
private static List<Dependency> extractSelectedDeps(List<Dependency> dps, int selectionStart, int selectionEnd) {
    List<Dependency> toRet = new ArrayList<Dependency>();
    for (Dependency d : dps) {
        int pos = d.findPosition();
        int endPos = d.findEndPosition();
        if (pos >= selectionStart && endPos <= selectionEnd) {
            if (d.getVersion() != null) {
                toRet.add(d);
            }
        }
    }
    return toRet;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:14,代码来源:MoveToDependencyManagementHint.java


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