本文整理汇总了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());
}
}
}
示例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));
}
示例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;
}
示例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);
}