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


Java Dependency.getArtifactId方法代码示例

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


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

示例1: getDynamicValueCompletion

import org.apache.maven.model.Dependency; //导入方法依赖的package包/类
@Override
protected Enumeration<GrammarResult> getDynamicValueCompletion(String path, HintContext hintCtx, Element lowestParent) {
    if ("/nbm/dependencies/dependency/type".equals(path)) { //NOI18N
        return createTextValueList(new String[] {
            "spec", //NOI18N
            "impl", //NOI18N
            "loose" //NOI18N
            }, hintCtx);
    }
    if ("/nbm/moduleType".equals(path)) { //NOI18N
        return createTextValueList(new String[] {
            "normal", //NOI18N
            "autoload", //NOI18N
            "eager" //NOI18N
            }, hintCtx);
        
    }
    if ("/nbm/dependencies/dependency/id".equals(path) || //NOI18N
        "/nbm/libraries/library".equals(path)) { //NOI18N
        //TODO could be nice to filter out the dependencies that are already being used..
        List<GrammarResult> toRet = new ArrayList<GrammarResult>();
        MavenProject project = getMavenProject();
        if (project != null) {
            @SuppressWarnings("unchecked")
            Iterator<Dependency> it = project.getCompileDependencies().iterator();
            while (it.hasNext()) {
                Dependency elem = it.next();
                String str = elem.getGroupId() + ":" + elem.getArtifactId(); //NOI18N
                if (str.startsWith(hintCtx.getCurrentPrefix())) {
                    toRet.add(new MyTextElement(str, hintCtx.getCurrentPrefix()));
                }
            }
        }
        return Collections.enumeration(toRet);
    }
    return null;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:38,代码来源:MavenNbmGrammar.java

示例2: filter

import org.apache.maven.model.Dependency; //导入方法依赖的package包/类
private Collection<NBVersionInfo> filter(NbMavenProject mavProj, List<NBVersionInfo> nbvis, boolean test) {


        Map<String, NBVersionInfo> items = new HashMap<String, NBVersionInfo>();
        //check dependency already added
        List<Dependency> dependencies = new ArrayList<Dependency>();
        MavenProject prj = mavProj.getMavenProject();
        if (test) {
            dependencies.addAll(prj.getTestDependencies());
        } else {
            dependencies.addAll(prj.getDependencies());
        }

        for (NBVersionInfo info : nbvis) {
            String key = info.getGroupId() + ":" + info.getArtifactId();

            boolean b = items.containsKey(key);
            if (!b) {
                items.put(key, info);
            }
            for (Dependency dependency : dependencies) {
                //check group id and ArtifactId and Scope even
                if (dependency.getGroupId() != null && dependency.getGroupId().equals(info.getGroupId())) {
                    if (dependency.getArtifactId() != null && dependency.getArtifactId().equals(info.getArtifactId())) {
                        if (!test && dependency.getScope() != null && ("compile".equals(dependency.getScope()))) {//NOI18N

                            return Collections.emptyList();
                        }
                    }
                }
            }

        }
        List<NBVersionInfo> filterd = new ArrayList<NBVersionInfo>(items.values());

        return filterd;

    }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:39,代码来源:SearchClassDependencyInRepo.java

示例3: 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

示例4: 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

示例5: 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

示例6: getDynamicValueCompletion

import org.apache.maven.model.Dependency; //导入方法依赖的package包/类
@Override
protected Enumeration<GrammarResult> getDynamicValueCompletion(String path, HintContext virtualTextCtx, Element element) {
    if ("/assembly/dependencySets/dependencySet/includes/include".equals(path) || //NOI18N
        "/assembly/dependencySets/dependencySet/excludes/exclude".equals(path)) { //NOI18N
        //TODO could be nice to filter out the dependencies that are already being used..
        List<GrammarResult> toRet = new ArrayList<GrammarResult>();
        MavenProject project = getMavenProject();
        if (project != null) {
            Node previous;
            // HACK.. if currentPrefix is zero length, the context is th element, otherwise it's the content inside
            if (virtualTextCtx.getCurrentPrefix().length() == 0) {
                 previous = virtualTextCtx.getParentNode().getParentNode(); 
            } else {
                previous = virtualTextCtx.getParentNode().getParentNode().getParentNode();
            }
            previous = previous.getPreviousSibling();
            String scope = null;
            while (previous != null) {
                if (previous instanceof org.w3c.dom.Element) {
                    org.w3c.dom.Element el = (org.w3c.dom.Element)previous;
                    NodeList lst = el.getChildNodes();
                    if (lst.getLength() > 0) {
                        if ("scope".equals(el.getNodeName())) { //NOI18N
                            scope = lst.item(0).getNodeValue();
                            break;
                        }
                    }
                }
                previous = previous.getPreviousSibling();
            }
            if (scope == null) {
                scope = "runtime"; //NOI18N
            }
            scope = scope.trim();
            Iterator it;
            if ("runtime".equals(scope)) { //NOI18N
                it = project.getRuntimeDependencies().iterator();
            } else if ("test".equals(scope)) { //NOI18N
                it = project.getTestDependencies().iterator();
            } else if ("compile".equals(scope)) { //NOI18N
                it = project.getCompileDependencies().iterator();
            } else {
                ErrorManager.getDefault().log(ErrorManager.WARNING, "How to process includes/excludes for scope '" + scope + "'? Fallback to 'runtime'."); //NOI18N
                it = project.getRuntimeDependencies().iterator();
            }
            while (it.hasNext()) {
                Dependency elem = (Dependency) it.next();
                String str = elem.getGroupId() + ":" + elem.getArtifactId(); //NOI18N
                if (str.startsWith(virtualTextCtx.getCurrentPrefix())) {
                    toRet.add(new MyTextElement(str, virtualTextCtx.getCurrentPrefix()));
                }
            }
        }
        return Collections.enumeration(toRet);
    }
    return null;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:58,代码来源:MavenAssemblyGrammar.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: toMavenDependency

import org.apache.maven.model.Dependency; //导入方法依赖的package包/类
public static MavenArtifactKey toMavenDependency(Dependency dependency) {
    return new MavenArtifactKey(dependency.getGroupId(), dependency.getArtifactId());
}
 
开发者ID:fabric8-updatebot,项目名称:updatebot,代码行数:4,代码来源:MavenHelper.java

示例9: ArtifactId

import org.apache.maven.model.Dependency; //导入方法依赖的package包/类
public ArtifactId( Dependency dependency )
{
    this( dependency.getGroupId(), dependency.getArtifactId(), dependency.getType(), dependency.getClassifier() );
}
 
开发者ID:javiersigler,项目名称:apache-maven-shade-plugin,代码行数:5,代码来源:ArtifactId.java


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