本文整理了Java中org.apache.maven.model.Model.removeModule()
方法的一些代码示例,展示了Model.removeModule()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Model.removeModule()
方法的具体详情如下:
包路径:org.apache.maven.model.Model
类名称:Model
方法名:removeModule
暂无
代码示例来源:origin: com.buschmais.jqassistant.plugin/jqassistant.plugin.m2repo
@Override
public void removeModule(String string) {
delegate.removeModule(string);
}
代码示例来源:origin: io.teecube.t3/t3-common
public static void removeProjectAsModule(File pom, String relativePath, String profileId) throws IOException, XmlPullParserException {
if (relativePath == null) return;
Model model = getModelFromPOM(pom);
relativePath = relativePath.replace("\\", "/");
File modulePomToRemove = getPomOfModule(pom, relativePath);
if (profileId != null && !profileId.isEmpty()) {
Profile p = getProfile(model, profileId);
if (p != null) {
for (String module : p.getModules()) {
File modulePom = getPomOfModule(pom, module);
if (java.nio.file.Files.isSameFile(modulePom.toPath(), modulePomToRemove.toPath())) {
p.removeModule(module);
break;
}
}
}
} else {
for (String module : model.getModules()) {
File modulePom = getPomOfModule(pom, module);
if (java.nio.file.Files.isSameFile(modulePom.toPath(), modulePomToRemove.toPath())) {
model.removeModule(module);
break;
}
}
}
writeModelToPOM(model, pom);
}
代码示例来源:origin: org.codehaus.mevenide/nb-project
private void checkParentProject(FileObject projectDir, boolean delete, String newName, String oldName) throws IOException {
String prjLoc = projectDir.getNameExt();
FileObject fo = projectDir.getParent();
Project possibleParent = ProjectManager.getDefault().findProject(fo);
if (possibleParent != null) {
NbMavenProject par = possibleParent.getLookup().lookup(NbMavenProject.class);
if (par != null) {
FileObject pomFO = par.getProjectDirectory().getFileObject("pom.xml"); //NOI18N
Model mdl = WriterUtils.loadModel(pomFO);
MavenProject prj = par.getOriginalMavenProject();
if ((prj.getModules() != null && prj.getModules().contains(prjLoc)) == delete) {
//delete/add module from/to parent..
if (delete) {
mdl.removeModule(prjLoc);
} else {
mdl.addModule(prjLoc);
}
}
if (newName != null && oldName != null) {
if (oldName.equals(mdl.getArtifactId())) {
// is this condition necessary.. why not just overwrite the artifactID always..
mdl.setArtifactId(newName);
}
}
WriterUtils.writePomModel(pomFO, mdl);
}
}
}
内容来源于网络,如有侵权,请联系作者删除!