本文整理匯總了Java中org.apache.maven.model.Dependency.getGroupId方法的典型用法代碼示例。如果您正苦於以下問題:Java Dependency.getGroupId方法的具體用法?Java Dependency.getGroupId怎麽用?Java Dependency.getGroupId使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.maven.model.Dependency
的用法示例。
在下文中一共展示了Dependency.getGroupId方法的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;
}
示例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;
}
示例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;
}
示例4: toId
import org.apache.maven.model.Dependency; //導入方法依賴的package包/類
private String toId (Dependency dependency) {
return dependency.getGroupId() + ":" + dependency.getArtifactId() + ":" + dependency.getVersion();
}
示例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());
}
示例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;
}
示例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());
}
示例8: toMavenDependency
import org.apache.maven.model.Dependency; //導入方法依賴的package包/類
public static MavenArtifactKey toMavenDependency(Dependency dependency) {
return new MavenArtifactKey(dependency.getGroupId(), dependency.getArtifactId());
}
示例9: ArtifactId
import org.apache.maven.model.Dependency; //導入方法依賴的package包/類
public ArtifactId( Dependency dependency )
{
this( dependency.getGroupId(), dependency.getArtifactId(), dependency.getType(), dependency.getClassifier() );
}