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

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

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

Profile.getDependencies介绍

暂无

代码示例

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

public void inject( Profile profile, Model model )
{
  model.setDependencies( injectDependencies( profile.getDependencies(), model.getDependencies() ) );
  injectModules( profile, model );
  model.setRepositories( ModelUtils.mergeRepositoryLists( profile.getRepositories(), model.getRepositories() ) );
  model.setPluginRepositories( ModelUtils.mergeRepositoryLists( profile.getPluginRepositories(), model
    .getPluginRepositories() ) );
  injectReporting( profile, model );
  injectDependencyManagement( profile, model );
  injectDistributionManagement( profile, model );
  injectBuild( profile, model );
  Properties props = new Properties();
  props.putAll( model.getProperties() );
  props.putAll( profile.getProperties() );
  model.setProperties( props );
}

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

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

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

prefix + ".activation", request );
validate20RawDependencies( problems, profile.getDependencies(), prefix + ".dependencies.dependency",
              request );

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

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

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

dependencies( profile.getDependencies() );

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

@Override
protected List<Resource<?>> doListResources()
{
 List<Resource<?>> children = new ArrayList<Resource<?>>();
 for (Dependency dep : profile.getDependencies())
 {
   children.add(new MavenDependencyResourceImpl(this, dep));
 }
 return children;
}

代码示例来源:origin: errai/errai

/**
 * Get a dependency if it exists in the given profile, or null.
 */
protected Dependency getDependency(final Profile profile, final DependencyBuilder dep) {
 if (profile == null)
  return null;
 for (final Dependency profDep : profile.getDependencies()) {
  if (MavenConverter.areSameArtifact(profDep, dep))
   return profDep;
 }
 return null;
}

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

@Override
protected List<Resource<?>> doListResources()
{
 List<Resource<?>> children = new ArrayList<>();
 for (Dependency dep : profile.getDependencies())
 {
   children.add(new MavenDependencyResourceImpl(getResourceFactory(), this, dep));
 }
 return children;
}

代码示例来源:origin: com.itemis.maven.plugins/unleash-maven-plugin

private Set<ArtifactCoordinates> getSnapshots(Profile profile, PomPropertyResolver propertyResolver) {
 this.log.debug("\t\tChecking direct dependencies of profile '" + profile.getId() + "'");
 Collection<Dependency> snapshots = Collections2.filter(profile.getDependencies(),
   new IsSnapshotDependency(propertyResolver));
 return Sets.newHashSet(Collections2.transform(snapshots, DependencyToCoordinates.INSTANCE));
}

代码示例来源:origin: shillner/unleash-maven-plugin

private Set<ArtifactCoordinates> getSnapshots(Profile profile, PomPropertyResolver propertyResolver) {
 this.log.debug("\t\tChecking direct dependencies of profile '" + profile.getId() + "'");
 Collection<Dependency> snapshots = Collections2.filter(profile.getDependencies(),
   new IsSnapshotDependency(propertyResolver));
 return Sets.newHashSet(Collections2.transform(snapshots, DependencyToCoordinates.INSTANCE));
}

代码示例来源:origin: com.itemis.maven.plugins/unleash-maven-plugin

private void setProfilesReactorDependenciesVersion(MavenProject project, Document document) {
 List<Profile> profiles = this.rawModels.getUnchecked(project).getProfiles();
 for (Profile profile : profiles) {
  final String dependenciesPath = "/profiles/profile[id[text()='" + profile.getId() + "']]";
  List<Dependency> dependencies = profile.getDependencies();
  for (Dependency dependency : dependencies) {
   trySetDependencyVersionFromReactorProjects(project, document, dependenciesPath, dependency);
  }
 }
}

代码示例来源:origin: org.commonjava.maven.ext/pom-manipulation-common

/**
 * This method will scan the dependencies in the potentially active Profiles in this project and
 * return a fully resolved list.  Note that this will only return full dependencies not managed
 * i.e. those with a group, artifact and version.
 *
 * Note that while updating the {@link Dependency} reference returned will be reflected in the
 * Model as it is the same object, if you wish to remove or add items to the Model then you
 * must use {@link #getModel()}
 *
 * @param session MavenSessionHandler, used by {@link PropertyResolver}
 * @return a list of fully resolved {@link ArtifactRef} to the original {@link Dependency}
 * @throws ManipulationException if an error occurs
 */
public Map<Profile, Map<ArtifactRef, Dependency>> getResolvedProfileDependencies( MavenSessionHandler session) throws ManipulationException
{
  Map<Profile, Map<ArtifactRef, Dependency>> resolvedProfileDependencies = new HashMap<>();
  for ( final Profile profile : ProfileUtils.getProfiles( session, model ) )
  {
    Map<ArtifactRef, Dependency> profileDeps = new HashMap<>();
    resolveDeps( session, profile.getDependencies(), false, profileDeps );
    resolvedProfileDependencies.put( profile, profileDeps );
  }
  return resolvedProfileDependencies;
}

代码示例来源:origin: org.commonjava.maven.ext/pom-manipulation-common

/**
 * This method will scan the dependencies in the potentially active Profiles in this project and
 * return a fully resolved list. Note that this will return all dependencies including managed
 * i.e. those with a group, artifact and potentially empty version.
 *
 * Note that while updating the {@link Dependency} reference returned will be reflected in the
 * Model as it is the same object, if you wish to remove or add items to the Model then you
 * must use {@link #getModel()}
 *
 * @param session MavenSessionHandler, used by {@link PropertyResolver}
 * @return a list of fully resolved {@link ArtifactRef} to the original {@link Dependency}
 * @throws ManipulationException if an error occurs
 */
public Map<Profile, Map<ArtifactRef, Dependency>> getAllResolvedProfileDependencies( MavenSessionHandler session) throws ManipulationException
{
  Map<Profile, Map<ArtifactRef, Dependency>> allResolvedProfileDependencies = new HashMap<>();
  for ( final Profile profile : ProfileUtils.getProfiles( session, model ) )
  {
    HashMap<ArtifactRef, Dependency> profileDeps = new HashMap<>();
    resolveDeps( session, profile.getDependencies(), true, profileDeps );
    allResolvedProfileDependencies.put( profile, profileDeps );
  }
  return allResolvedProfileDependencies;
}

代码示例来源:origin: errai/errai

private void removeProfileDependencies(final Model pom,
    final Map<String, Collection<DependencyBuilder>> removableProfileDependencies) {
 for (Profile profile : pom.getProfiles()) {
  if (removableProfileDependencies.containsKey(profile.getId())) {
   for (DependencyBuilder dep : removableProfileDependencies.get(profile.getId())) {
    List<Dependency> profDeps = profile.getDependencies();
    for (int i = 0; i < profDeps.size(); i++) {
     if (MavenConverter.areSameArtifact(profDeps.get(i), dep)) {
      profDeps.remove(i);
      break;
     }
    }
   }
  }
 }
}

代码示例来源:origin: shillner/unleash-maven-plugin

private void setProfilesReactorDependenciesVersion(MavenProject project, Document document) {
 List<Profile> profiles = this.rawModels.getUnchecked(project).getProfiles();
 for (Profile profile : profiles) {
  final String dependenciesPath = "/profiles/profile[id[text()='" + profile.getId() + "']]";
  List<Dependency> dependencies = profile.getDependencies();
  for (Dependency dependency : dependencies) {
   trySetDependencyVersionFromReactorProjects(project, document, dependenciesPath, dependency);
  }
 }
}

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

相关文章