當前位置: 首頁>>代碼示例>>Java>>正文


Java DependencyManagement類代碼示例

本文整理匯總了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;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:21,代碼來源:ModelUtils.java

示例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());
        }
    }
}
 
開發者ID:AlexFalappa,項目名稱:nb-springboot,代碼行數:25,代碼來源:InjectSpringBootGenerator.java

示例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++;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:9,代碼來源:POMModelVisitor.java

示例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;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:16,代碼來源:MavenTestNGSupport.java

示例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;
}
 
開發者ID:jeddict,項目名稱:jCode,代碼行數:10,代碼來源:POMManager.java

示例6: visit

import org.netbeans.modules.maven.model.pom.DependencyManagement; //導入依賴的package包/類
@Override
public void visit(DependencyManagement target) {
    visitComponent(target);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:5,代碼來源:DefaultVisitor.java


注:本文中的org.netbeans.modules.maven.model.pom.DependencyManagement類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。