本文整理匯總了Java中org.netbeans.modules.maven.model.pom.DependencyManagement類的典型用法代碼示例。如果您正苦於以下問題:Java DependencyManagement類的具體用法?Java DependencyManagement怎麽用?Java DependencyManagement使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
DependencyManagement類屬於org.netbeans.modules.maven.model.pom包,在下文中一共展示了DependencyManagement類的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: checkModelDependency
import org.netbeans.modules.maven.model.pom.DependencyManagement; //導入依賴的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;
}
示例2: addBom
import org.netbeans.modules.maven.model.pom.DependencyManagement; //導入依賴的package包/類
private void addBom(JsonNode depsMeta, String bomId) {
JsonNode bomInfo = depsMeta.path("boms").path(bomId);
// create dependency management section in pom if missing
DependencyManagement depMan = model.getProject().getDependencyManagement();
if (depMan == null) {
depMan = model.getFactory().createDependencyManagement();
model.getProject().setDependencyManagement(depMan);
}
// add a dependency with type pom and scope import
Dependency dep = model.getFactory().createDependency();
dep.setGroupId(bomInfo.path("groupId").asText());
dep.setArtifactId(bomInfo.path("artifactId").asText());
dep.setVersion(bomInfo.path("version").asText());
dep.setType("pom");
dep.setScope("import");
depMan.addDependency(dep);
// bom may require extra repositories
if (bomInfo.hasNonNull("repositories")) {
for (JsonNode rep : bomInfo.path("repositories")) {
addRepository(depsMeta, rep.asText());
addPluginRepository(depsMeta, rep.asText());
}
}
}
示例3: visit
import org.netbeans.modules.maven.model.pom.DependencyManagement; //導入依賴的package包/類
@Override
public void visit(DependencyManagement target) {
DependencyManagement t = target;
assert t != null ? t.isInDocumentModel() : true;
checkDependencies(t);
count++;
}
示例4: hasEffectiveDependency
import org.netbeans.modules.maven.model.pom.DependencyManagement; //導入依賴的package包/類
private boolean hasEffectiveDependency(String groupId, String artifactId, NbMavenProject prj) {
MavenProject mp = prj.getMavenProject();
List<org.apache.maven.model.Dependency> dl = new ArrayList<org.apache.maven.model.Dependency>();
dl.addAll(mp.getDependencies());
org.apache.maven.model.DependencyManagement dm = mp.getDependencyManagement();
if (dm != null) {
dl.addAll(dm.getDependencies());
}
for (org.apache.maven.model.Dependency d : dl) {
if (groupId.equals(d.getGroupId()) && artifactId.equals(d.getArtifactId())) {
return true;
}
}
return false;
}
示例5: registerDependencyManagement
import org.netbeans.modules.maven.model.pom.DependencyManagement; //導入依賴的package包/類
private DependencyManagement registerDependencyManagement(org.apache.maven.model.DependencyManagement source, DependencyManagement target) {
if (source != null) {
if (target == null) {
target = pomModel.getFactory().createDependencyManagement();
}
registerDependency(source.getDependencies(), target);
}
return target;
}
示例6: visit
import org.netbeans.modules.maven.model.pom.DependencyManagement; //導入依賴的package包/類
@Override
public void visit(DependencyManagement target) {
visitComponent(target);
}