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


Java Dependency.setType方法代码示例

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


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

示例1: addBom

import org.netbeans.modules.maven.model.pom.Dependency; //导入方法依赖的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

示例2: addDependency

import org.netbeans.modules.maven.model.pom.Dependency; //导入方法依赖的package包/类
/**
 * 
 * @param pom       FileObject that represents POM
 * @param group     
 * @param artifact
 * @param version
 * @param type
 * @param scope
 * @param classifier
 * @param acceptNull accept null values to scope,type and classifier.
 *                   If true null values will remove corresponding tag.
 */
public static void addDependency(FileObject pom,
        final String group,
        final String artifact,
        final String version,
        final String type,
        final String scope,
        final String classifier, final boolean acceptNull)
{
    ModelOperation<POMModel> operation = new ModelOperation<POMModel>() {
        private static final String BUNDLE_TYPE = "bundle"; //NOI18N
        @Override
        public void performOperation(POMModel model) {
            Dependency dep = checkModelDependency(model, group, artifact, true);
            dep.setVersion(version);
            if (acceptNull || scope != null) {
                dep.setScope(scope);
            }
            if (acceptNull || (type != null && !BUNDLE_TYPE.equals(type))) {
                dep.setType(type);
            }
            if (acceptNull || classifier != null) {
                dep.setClassifier(classifier);
            }
        }
    };
    Utilities.performPOMModelOperations(pom, Collections.singletonList(operation));
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:40,代码来源:ModelUtils.java

示例3: createDependency

import org.netbeans.modules.maven.model.pom.Dependency; //导入方法依赖的package包/类
private Dependency createDependency(org.apache.maven.model.Dependency source) {
    Dependency target = pomModel.getFactory().createDependency();
    target.setGroupId(source.getGroupId());
    target.setArtifactId(source.getArtifactId());
    target.setClassifier(source.getClassifier());
    if (!"jar".equals(source.getType())) {
        target.setType(source.getType());
    }
    target.setScope(source.getScope());
    return target;
}
 
开发者ID:jeddict,项目名称:jCode,代码行数:12,代码来源:POMManager.java

示例4: performOperation

import org.netbeans.modules.maven.model.pom.Dependency; //导入方法依赖的package包/类
@Override
public void performOperation(POMModel model) {
    Dependency dep = ModelUtils.checkModelDependency(model, group, artifact, true);
    dep.setVersion(version);
    dep.setType(type);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:7,代码来源:ArchetypeWizardUtils.java


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