org.apache.maven.model.Model.addModule()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(2.6k)|赞(0)|评价(0)|浏览(152)

本文整理了Java中org.apache.maven.model.Model.addModule()方法的一些代码示例,展示了Model.addModule()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Model.addModule()方法的具体详情如下:
包路径:org.apache.maven.model.Model
类名称:Model
方法名:addModule

Model.addModule介绍

暂无

代码示例

代码示例来源:origin: takari/polyglot-maven

public void modules(String... modules) {
  if (modules != null) {
    Arrays.asList(modules).forEach(module -> model.addModule(module));
  }
}

代码示例来源:origin: ru.yandex.qatools.clay/clay-maven-settings-builder

/**
 * Method addModule.
 *
 * @param string
 */
public FluentModelBuilder withModule(String string) {
  model.addModule(string);
  return this;
}

代码示例来源:origin: com.buschmais.jqassistant.plugin/jqassistant.plugin.m2repo

@Override
public void addModule(String string) {
  delegate.addModule(string);
}

代码示例来源:origin: io.teecube.t3/t3-common

/**
 * Add a project as a module.
 *
 * @param pom
 * @param relativePath
 * @throws IOException
 * @throws XmlPullParserException
 */
public static void addProjectAsModule(File pom, String relativePath, String profileId, boolean ignoreIfExists) throws IOException, XmlPullParserException {
  if (relativePath == null) return;
  Model model = getModelFromPOM(pom);
  relativePath = relativePath.replace("\\", "/");
  if (profileId != null && !profileId.isEmpty()) {
    Profile p = getProfile(model, profileId);
    if (p != null) {
      if (ignoreIfExists && moduleExists(pom, relativePath)) {
        return; // ignore
      }
      p.addModule(relativePath);
    }
  } else {
    if (ignoreIfExists && moduleExists(pom, relativePath)) {
      return; // ignore
    }
    model.addModule(relativePath);
  }
  writeModelToPOM(model, pom);
}

代码示例来源:origin: org.jboss.forge.addon/maven-impl-projects

parentPom.addModule(moduleDir);
parentMavenFacet.setModel(parentPom);

代码示例来源: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);
    }
  }
  
}

相关文章

Model类方法