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

x33g5p2x  于2022-01-26 转载在 其他  
字(15.0k)|赞(0)|评价(0)|浏览(106)

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

Profile.getModules介绍

暂无

代码示例

代码示例来源:origin: org.apache.maven/maven-project

/**
 * Append modules specified in the profile to the end of the list supplied by the model, if
 * they don't already exist.
 */
private void injectModules( Profile profile, Model model )
{
  List modules = new ArrayList();
  List modelModules = model.getModules();
  if ( ( modelModules != null ) && !modelModules.isEmpty() )
  {
    modules.addAll( modelModules );
  }
  List profileModules = profile.getModules();
  if ( profileModules != null )
  {
    for ( Iterator it = profileModules.iterator(); it.hasNext(); )
    {
      String module = (String) it.next();
      if ( !modules.contains( module ) )
      {
        modules.add( module );
      }
    }
  }
  model.setModules( modules );
}

代码示例来源:origin: apache/maven

if ( ( profile.getModules() != null ) && ( profile.getModules().size() > 0 ) )
  for ( Iterator iter = profile.getModules().iterator(); iter.hasNext(); )

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

if ( ( profile.getModules() != null ) && ( profile.getModules().size() > 0 ) )
  for ( Iterator iter = profile.getModules().iterator(); iter.hasNext(); )

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

modules( profile.getModules() );

代码示例来源:origin: mojohaus/versions-maven-plugin

/**
 * Returns a set of all child modules for a project, including any defined in profiles (ignoring profile
 * activation).
 *
 * @param model The project model.
 * @param logger The logger to use.
 * @return the set of all child modules of the project.
 */
public static Set<String> getAllChildModules( Model model, Log logger )
{
  logger.debug( "Finding child modules..." );
  Set<String> childModules = new TreeSet<String>();
  childModules.addAll( model.getModules() );
  for ( Profile profile : model.getProfiles() )
  {
    childModules.addAll( profile.getModules() );
  }
  debugModules( logger, "Child modules:", childModules );
  return childModules;
}

代码示例来源:origin: org.codehaus.mojo/versions-maven-plugin

/**
 * Returns a set of all child modules for a project, including any defined in profiles (ignoring profile
 * activation).
 *
 * @param model The project model.
 * @param logger The logger to use.
 * @return the set of all child modules of the project.
 */
public static Set<String> getAllChildModules( Model model, Log logger )
{
  logger.debug( "Finding child modules..." );
  Set<String> childModules = new TreeSet<String>();
  childModules.addAll( model.getModules() );
  for ( Profile profile : model.getProfiles() )
  {
    childModules.addAll( profile.getModules() );
  }
  debugModules( logger, "Child modules:", childModules );
  return childModules;
}

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

/**
 * Check whether a module exists in a POM.
 *
 * @param pom
 * @param relativePath
 * @param profileId
 * @return
 * @throws XmlPullParserException
 * @throws IOException
 */
public static boolean moduleExists(File pom, String relativePath, String profileId) throws IOException, XmlPullParserException {
  if (relativePath == null) return false;
  Model model = getModelFromPOM(pom);
  relativePath = relativePath.replace("\\", "/");
  if (profileId != null && !profileId.isEmpty()) {
    Profile p = getProfile(model, profileId);
    if (p != null) {
      return p.getModules().indexOf(relativePath) >= 0;
    }
  } else {
    return model.getModules().indexOf(relativePath) >= 0;
  }
  return false;
}

代码示例来源:origin: org.apache.maven.plugins/maven-invoker-plugin

modulePaths.addAll( profile.getModules() );

代码示例来源: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.netbeans.modules/org-netbeans-modules-maven-embedder

for (String module : p.getModules()) {
  if (!modules.contains(module)) {
    modules.add(module);

代码示例来源:origin: io.tesla.maven/maven-model

if ( ( profile.getModules() != null ) && ( profile.getModules().size() > 0 ) )
  for ( Iterator iter = profile.getModules().iterator(); iter.hasNext(); )

代码示例来源:origin: io.tesla.polyglot/tesla-polyglot-ruby

modules( profile.getModules() );

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

/**
 * Adds information about defined profile.
 * 
 * @param pomDescriptor
 *            The descriptor for the current POM.
 * @param model
 *            The Maven Model.
 * @param scannerContext
 *            The scanner context.
 */
private void addProfiles(MavenPomDescriptor pomDescriptor, Model model, ScannerContext scannerContext) {
  List<Profile> profiles = model.getProfiles();
  Store store = scannerContext.getStore();
  for (Profile profile : profiles) {
    MavenProfileDescriptor mavenProfileDescriptor = store.create(MavenProfileDescriptor.class);
    pomDescriptor.getProfiles().add(mavenProfileDescriptor);
    mavenProfileDescriptor.setId(profile.getId());
    addProperties(mavenProfileDescriptor, profile.getProperties(), store);
    addModules(mavenProfileDescriptor, profile.getModules(), store);
    addPlugins(mavenProfileDescriptor, profile.getBuild(), scannerContext);
    addManagedPlugins(mavenProfileDescriptor, profile.getBuild(), scannerContext);
    addManagedDependencies(mavenProfileDescriptor, profile.getDependencyManagement(), scannerContext, ProfileManagesDependencyDescriptor.class);
    addProfileDependencies(mavenProfileDescriptor, profile.getDependencies(), scannerContext);
    addActivation(mavenProfileDescriptor, profile.getActivation(), store);
  }
}

代码示例来源:origin: org.apache.maven.plugins/maven-shade-plugin

/**
 * Method updateProfile
 *
 * @param value
 * @param element
 * @param counter
 * @param xmlTag
 */
protected void updateProfile( Profile value, String xmlTag, Counter counter, Element element )
{
  Element root = element;
  Counter innerCount = new Counter( counter.getDepth() + 1 );
  findAndReplaceSimpleElement( innerCount, root, "id", value.getId(), "default" );
  // updateActivation( value.getActivation(), "activation", innerCount, root);
  updateBuildBase( value.getBuild(), "build", innerCount, root );
  findAndReplaceSimpleLists( innerCount, root, value.getModules(), "modules", "module" );
  iterateRepository( innerCount, root, value.getRepositories(), "repositories", "repository" );
  iterateRepository( innerCount, root, value.getPluginRepositories(), "pluginRepositories", "pluginRepository" );
  iterateDependency( innerCount, root, value.getDependencies(), "dependencies", "dependency" );
  findAndReplaceXpp3DOM( innerCount, root, "reports", (Xpp3Dom) value.getReports() );
  updateReporting( value.getReporting(), "reporting", innerCount, root );
  updateDependencyManagement( value.getDependencyManagement(), "dependencyManagement", innerCount, root );
  updateDistributionManagement( value.getDistributionManagement(), "distributionManagement", innerCount, root );
  findAndReplaceProperties( innerCount, root, "properties", value.getProperties() );
} // -- void updateProfile(Profile, String, Counter, Element)

代码示例来源:origin: org.apache.felix/maven-bundle-plugin

/**
 * Method updateProfile
 *
 * @param value
 * @param element
 * @param counter
 * @param xmlTag
 */
protected void updateProfile( Profile value, String xmlTag, Counter counter, Element element )
{
  Element root = element;
  Counter innerCount = new Counter( counter.getDepth() + 1 );
  findAndReplaceSimpleElement( innerCount, root, "id", value.getId(), "default" );
  // updateActivation( value.getActivation(), "activation", innerCount, root);
  updateBuildBase( value.getBuild(), "build", innerCount, root );
  findAndReplaceSimpleLists( innerCount, root, value.getModules(), "modules", "module" );
  iterateRepository( innerCount, root, value.getRepositories(), "repositories", "repository" );
  iterateRepository( innerCount, root, value.getPluginRepositories(), "pluginRepositories", "pluginRepository" );
  iterateDependency( innerCount, root, value.getDependencies(), "dependencies", "dependency" );
  findAndReplaceXpp3DOM( innerCount, root, "reports", (Xpp3Dom) value.getReports() );
  updateReporting( value.getReporting(), "reporting", innerCount, root );
  updateDependencyManagement( value.getDependencyManagement(), "dependencyManagement", innerCount, root );
  updateDistributionManagement( value.getDistributionManagement(), "distributionManagement", innerCount, root );
  findAndReplaceProperties( innerCount, root, "properties", value.getProperties() );
} // -- void updateProfile(Profile, String, Counter, Element)

代码示例来源:origin: org.codehaus.mevenide/nb-mvn-embedder

/**
 * Method updateProfile
 * 
 * @param value
 * @param element
 * @param counter
 * @param xmlTag
 */
protected void updateProfile(Profile value, String xmlTag, Counter counter, Element element)
{
  Element root = element;
  Counter innerCount = new Counter(counter.getDepth() + 1);
  findAndReplaceSimpleElement(innerCount, root,  "id", value.getId(), null);
  updateActivation( value.getActivation(), "activation", innerCount, root);
  updateBuildBase( value.getBuild(), "build", innerCount, root);
  findAndReplaceSimpleLists(innerCount, root, value.getModules(), "modules", "module");
  iterateRepository(innerCount, root, value.getRepositories(),"repositories","repository");
  iterateRepository(innerCount, root, value.getPluginRepositories(),"pluginRepositories","pluginRepository");
  iterateDependency(innerCount, root, value.getDependencies(),"dependencies","dependency");
  findAndReplaceXpp3DOM(innerCount, root, "reports", (Xpp3Dom)value.getReports());
  updateReporting( value.getReporting(), "reporting", innerCount, root);
  updateDependencyManagement( value.getDependencyManagement(), "dependencyManagement", innerCount, root);
  updateDistributionManagement( value.getDistributionManagement(), "distributionManagement", innerCount, root);
  findAndReplaceProperties(innerCount, root,  "properties", value.getProperties());
} //-- void updateProfile(Profile, String, Counter, Element)

代码示例来源:origin: org.netbeans.api/org-netbeans-modules-maven-embedder

/**
 * Method updateProfile.
 * 
 * @param value
 * @param element
 * @param counter
 * @param xmlTag
 */
protected void updateProfile(Profile value, String xmlTag, Counter counter, Element element)
{
  Element root = element;
  Counter innerCount = new Counter(counter.getDepth() + 1);
  findAndReplaceSimpleElement(innerCount, root,  "id", value.getId(), null);
  updateActivation( value.getActivation(), "activation", innerCount, root);
  updateBuildBase( value.getBuild(), "build", innerCount, root);
  findAndReplaceSimpleLists(innerCount, root, value.getModules(), "modules", "module");
  iterateRepository(innerCount, root, value.getRepositories(),"repositories","repository");
  iterateRepository(innerCount, root, value.getPluginRepositories(),"pluginRepositories","pluginRepository");
  iterateDependency(innerCount, root, value.getDependencies(),"dependencies","dependency");
  findAndReplaceXpp3DOM(innerCount, root, "reports", (Xpp3Dom)value.getReports());
  updateReporting( value.getReporting(), "reporting", innerCount, root);
  updateDependencyManagement( value.getDependencyManagement(), "dependencyManagement", innerCount, root);
  updateDistributionManagement( value.getDistributionManagement(), "distributionManagement", innerCount, root);
  findAndReplaceProperties(innerCount, root,  "properties", value.getProperties());
} //-- void updateProfile(Profile, String, Counter, Element)

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

/**
* Method updateProfile.
*
* @param value
* @param element
* @param counter
* @param xmlTag
*/
protected void updateProfile(Profile value, String xmlTag, Counter counter, Element element)
{
 Element root = element;
 Counter innerCount = new Counter(counter.getDepth() + 1);
 findAndReplaceSimpleElement(innerCount, root, "id", value.getId(), null);
 updateActivation(value.getActivation(), "activation", innerCount, root);
 updateBuildBase(value.getBuild(), "build", innerCount, root);
 findAndReplaceSimpleLists(innerCount, root, value.getModules(), "modules", "module");
 iterateRepository(innerCount, root, value.getRepositories(), "repositories", "repository");
 iterateRepository(innerCount, root, value.getPluginRepositories(), "pluginRepositories", "pluginRepository");
 iterateDependency(innerCount, root, value.getDependencies(), "dependencies", "dependency");
 findAndReplaceXpp3DOM(innerCount, root, "reports", (Xpp3Dom) value.getReports());
 updateReporting(value.getReporting(), "reporting", innerCount, root);
 updateDependencyManagement(value.getDependencyManagement(), "dependencyManagement", innerCount, root);
 updateDistributionManagement(value.getDistributionManagement(), "distributionManagement", innerCount, root);
 findAndReplaceProperties(innerCount, root, "properties", value.getProperties());
} // -- void updateProfile(Profile, String, Counter, Element)

代码示例来源:origin: apache/maven-archetype

/**
 * Method updateProfile.
 *
 * @param value
 * @param element
 * @param counter
 * @param xmlTag
 */
protected void updateProfile( Profile value, String xmlTag, Counter counter, Element element )
{
  Element root = element;
  Counter innerCount = new Counter( counter.getDepth() + 1 );
  findAndReplaceSimpleElement( innerCount, root, "id", value.getId(), null );
  updateActivation( value.getActivation(), "activation", innerCount, root );
  updateBuildBase( value.getBuild(), "build", innerCount, root );
  findAndReplaceSimpleLists( innerCount, root, value.getModules(), "modules", "module" );
  iterateRepository( innerCount, root, value.getRepositories(), "repositories", "repository" );
  iterateRepository( innerCount, root, value.getPluginRepositories(), "pluginRepositories", "pluginRepository" );
  iterateDependency( innerCount, root, value.getDependencies(), "dependencies", "dependency" );
  findAndReplaceXpp3DOM( innerCount, root, "reports", (Xpp3Dom) value.getReports() );
  updateReporting( value.getReporting(), "reporting", innerCount, root );
  updateDependencyManagement( value.getDependencyManagement(), "dependencyManagement", innerCount, root );
  updateDistributionManagement( value.getDistributionManagement(), "distributionManagement", innerCount, root );
  findAndReplaceProperties( innerCount, root, "properties", value.getProperties() );
} // -- void updateProfile(Profile, String, Counter, Element)

代码示例来源:origin: org.sonatype.maven.archetype/archetype-common

updateActivation( value.getActivation(), "activation", innerCount, root );
updateBuildBase( value.getBuild(), "build", innerCount, root );
findAndReplaceSimpleLists( innerCount, root, value.getModules(), "modules", "module" );
iterateRepository(
  innerCount,

相关文章