当前位置: 首页>>代码示例>>Java>>正文


Java PluginManagement类代码示例

本文整理汇总了Java中org.apache.maven.model.PluginManagement的典型用法代码示例。如果您正苦于以下问题:Java PluginManagement类的具体用法?Java PluginManagement怎么用?Java PluginManagement使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


PluginManagement类属于org.apache.maven.model包,在下文中一共展示了PluginManagement类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: writePluginManagement

import org.apache.maven.model.PluginManagement; //导入依赖的package包/类
private void writePluginManagement(PluginManagement pluginManagement, String tagName, XmlSerializer serializer)
        throws java.io.IOException {
    serializer.startTag(NAMESPACE, tagName);
    flush(serializer);
    StringBuffer b = b(serializer);
    int start = b.length();
    if ((pluginManagement.getPlugins() != null) && (pluginManagement.getPlugins().size() > 0)) {
        serializer.startTag(NAMESPACE, "plugins");
        for (Iterator iter = pluginManagement.getPlugins().iterator(); iter.hasNext();) {
            Plugin o = (Plugin) iter.next();
            writePlugin(o, "plugin", serializer);
        }
        serializer.endTag(NAMESPACE, "plugins");
    }
    serializer.endTag(NAMESPACE, tagName).flush();
    logLocation(pluginManagement, "", start, b.length());
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:18,代码来源:LocationAwareMavenXpp3Writer.java

示例2: collectManaged

import org.apache.maven.model.PluginManagement; //导入依赖的package包/类
private Map<String, String> collectManaged(Project prj) {
    NbMavenProject project = prj.getLookup().lookup(NbMavenProject.class);
    Map<String, String> toRet = new HashMap<String, String>();
    if (project == null) { //#154462
        return toRet;
    }
    PluginManagement pluginManagement = project.getMavenProject().getPluginManagement();
    if (pluginManagement == null) { // #189404
        return toRet;
    }
    for (org.apache.maven.model.Plugin plg : pluginManagement.getPlugins()) {
        if (plg.getGroupId().equals(Constants.GROUP_APACHE_PLUGINS)) {
            continue; // #189261 - might be from superpom
        }
        toRet.put(plg.getKey(), plg.getVersion());
    }
    return toRet;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:19,代码来源:OverridePluginManagementError.java

示例3: getSnapshotsFromManagement

import org.apache.maven.model.PluginManagement; //导入依赖的package包/类
private Multimap<ArtifactCoordinates, ArtifactCoordinates> getSnapshotsFromManagement(MavenProject project,
    PomPropertyResolver propertyResolver) {
  this.log.debug("\t\tChecking managed plugins");
  Multimap<ArtifactCoordinates, ArtifactCoordinates> result = HashMultimap.create();
  Build build = project.getBuild();
  if (build != null) {
    PluginManagement pluginManagement = build.getPluginManagement();
    if (pluginManagement != null) {
      for (Plugin plugin : pluginManagement.getPlugins()) {
        Collection<Dependency> snapshots = Collections2.filter(plugin.getDependencies(),
            new IsSnapshotDependency(propertyResolver));
        if (!snapshots.isEmpty()) {
          result.putAll(PluginToCoordinates.INSTANCE.apply(plugin),
              Collections2.transform(snapshots, DependencyToCoordinates.INSTANCE));
        }
      }
    }
  }
  return result;
}
 
开发者ID:shillner,项目名称:unleash-maven-plugin,代码行数:21,代码来源:CheckPluginDependencyVersions.java

示例4: visitBuildPluginManagement

import org.apache.maven.model.PluginManagement; //导入依赖的package包/类
private void visitBuildPluginManagement( ModelVisitor visitor, PluginManagement pluginManagement )
{
    List<Plugin> plugins = pluginManagement.getPlugins();
    if ( plugins != null )
    {
        ListIterator<Plugin> pluginIterator = plugins.listIterator();
        while ( pluginIterator.hasNext() )
        {
            Plugin plugin = pluginIterator.next();
            visitor.visitBuildPluginManagementPlugin( plugin );
            visitBuildPluginManagementPlugin( visitor, plugin );
            plugin = visitor.replaceBuildPluginManagementPlugin( plugin );
            if ( plugin == null )
                pluginIterator.remove();
            else
                pluginIterator.set( plugin );
        }
    }
}
 
开发者ID:fedora-java,项目名称:xmvn,代码行数:20,代码来源:DefaultModelProcessor.java

示例5: visitProfileBuildPluginManagement

import org.apache.maven.model.PluginManagement; //导入依赖的package包/类
private void visitProfileBuildPluginManagement( ModelVisitor visitor, PluginManagement pluginManagement )
{
    List<Plugin> plugins = pluginManagement.getPlugins();
    if ( plugins != null )
    {
        ListIterator<Plugin> pluginIterator = plugins.listIterator();
        while ( pluginIterator.hasNext() )
        {
            Plugin plugin = pluginIterator.next();
            visitor.visitProfileBuildPluginManagementPlugin( plugin );
            visitProfileBuildPluginManagementPlugin( visitor, plugin );
            plugin = visitor.replaceProfileBuildPluginManagementPlugin( plugin );
            if ( plugin == null )
                pluginIterator.remove();
            else
                pluginIterator.set( plugin );
        }
    }
}
 
开发者ID:fedora-java,项目名称:xmvn,代码行数:20,代码来源:DefaultModelProcessor.java

示例6: getRuleConfigurations

import org.apache.maven.model.PluginManagement; //导入依赖的package包/类
/**
 * Returns the rule configurations from the <tt>pluginManagement</tt> as well
 * as the <tt>plugins</tt> section.
 *
 * @param build the build to inspect.
 * @return configuration of the rules, may be an empty list.
 */
final List<Xpp3Dom> getRuleConfigurations( final Build build )
{
    @SuppressWarnings( "unchecked" )
    final Map<String, Plugin> plugins = build.getPluginsAsMap();
    final List<Xpp3Dom> ruleConfigurationsForPlugins = getRuleConfigurations( plugins );
    final PluginManagement pluginManagement = build.getPluginManagement();
    if ( pluginManagement != null )
    {
        @SuppressWarnings( "unchecked" )
        final Map<String, Plugin> pluginsFromManagementAsMap = pluginManagement.getPluginsAsMap();
        List<Xpp3Dom> ruleConfigurationsFromManagement = getRuleConfigurations( pluginsFromManagementAsMap );
        ruleConfigurationsForPlugins.addAll( ruleConfigurationsFromManagement );
    }
    return ruleConfigurationsForPlugins;
}
 
开发者ID:mojohaus,项目名称:extra-enforcer-rules,代码行数:23,代码来源:RequirePropertyDiverges.java

示例7: testExecuteInParentWithConfigurationInPluginManagement

import org.apache.maven.model.PluginManagement; //导入依赖的package包/类
/**
 * Test of execute method, of class RequirePropertyDiverges.
 */
@Test
public void testExecuteInParentWithConfigurationInPluginManagement() throws EnforcerRuleException
{
    RequirePropertyDiverges mockInstance = createMockRule();
    final MavenProject project = createMavenProject( "company", "company-parent-pom" );
    final Build build = new Build();
    // create pluginManagement
    final Plugin pluginInManagement = newPlugin( "org.apache.maven.plugins", "maven-enforcer-plugin", "1.0");
    final Xpp3Dom configuration = createPluginConfiguration();
    pluginInManagement.setConfiguration( configuration );
    final PluginManagement pluginManagement = new PluginManagement();
    pluginManagement.addPlugin( pluginInManagement );
    build.setPluginManagement( pluginManagement );
    // create plugins
    final Plugin pluginInPlugins = newPlugin( "org.apache.maven.plugins", "maven-enforcer-plugin", "1.0");
    build.addPlugin( pluginInPlugins );
    // add build
    project.getOriginalModel().setBuild( build );
    //project.getOriginalModel().setBuild( build );
    setUpHelper( project, "parentValue" );
    mockInstance.execute( helper );
}
 
开发者ID:mojohaus,项目名称:extra-enforcer-rules,代码行数:26,代码来源:RequirePropertyDivergesTest.java

示例8: testExecuteInParentWithConfigurationInExecution

import org.apache.maven.model.PluginManagement; //导入依赖的package包/类
/**
 * Test of execute method, of class RequirePropertyDiverges.
 */
@Test
public void testExecuteInParentWithConfigurationInExecution() throws EnforcerRuleException
{
    RequirePropertyDiverges mockInstance = createMockRule();
    final MavenProject project = createMavenProject( "company", "company-parent-pom" );
    final Build build = new Build();
    build.setPluginManagement( new PluginManagement() );
    final Plugin plugin = newPlugin( "org.apache.maven.plugins", "maven-enforcer-plugin", "1.0" );
    final Xpp3Dom configuration = createPluginConfiguration();
    PluginExecution pluginExecution = new PluginExecution();
    pluginExecution.setConfiguration( configuration );
    plugin.addExecution( pluginExecution );
    build.addPlugin( plugin );
    project.getOriginalModel().setBuild( build );
    setUpHelper(project, "parentValue");
    mockInstance.execute( helper );
}
 
开发者ID:mojohaus,项目名称:extra-enforcer-rules,代码行数:21,代码来源:RequirePropertyDivergesTest.java

示例9: getResolvedManagedPlugins

import org.apache.maven.model.PluginManagement; //导入依赖的package包/类
/**
 * This method will scan the plugins in the pluginManagement section of this project and return a fully
 * resolved list. Note that while updating the {@link Plugin} 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 ProjectVersionRef} to the original {@link Plugin}
 * @throws ManipulationException if an error occurs
 */
public HashMap<ProjectVersionRef, Plugin> getResolvedManagedPlugins ( MavenSessionHandler session) throws ManipulationException
{
    if ( resolvedManagedPlugins == null )
    {
        resolvedManagedPlugins = new HashMap<>(  );

        if ( getModel().getBuild() != null )
        {
            final PluginManagement pm = getModel().getBuild().getPluginManagement();
            if ( !( pm == null || pm.getPlugins() == null ) )
            {
                resolvePlugins( session, pm.getPlugins(), resolvedManagedPlugins );
            }
        }
    }

    return resolvedManagedPlugins;
}
 
开发者ID:release-engineering,项目名称:pom-manipulation-ext,代码行数:29,代码来源:Project.java

示例10: getResolvedProfileManagedPlugins

import org.apache.maven.model.PluginManagement; //导入依赖的package包/类
/**
 * This method will scan the plugins in the pluginManagement section in the potentially active Profiles
 * in this project and return a fully resolved list. Note that while updating the {@link Plugin}
 * 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 ProjectVersionRef} to the original {@link Plugin}
 * @throws ManipulationException if an error occurs
 */
public HashMap<Profile,HashMap<ProjectVersionRef,Plugin>> getResolvedProfileManagedPlugins( MavenSessionHandler session )
                throws ManipulationException
{
    if ( resolvedProfileManagedPlugins == null )
    {
        resolvedProfileManagedPlugins = new HashMap<>();

        for ( final Profile profile : ProfileUtils.getProfiles( session, model ) )
        {
            HashMap<ProjectVersionRef, Plugin> profileDeps = new HashMap<>();

            if ( profile.getBuild() != null )
            {
                final PluginManagement pm = profile.getBuild().getPluginManagement();
                if ( !( pm == null || pm.getPlugins() == null ) )
                {
                    resolvePlugins( session, pm.getPlugins(), profileDeps );
                }
            }
            resolvedProfileManagedPlugins.put( profile, profileDeps );
        }
    }
    return resolvedProfileManagedPlugins;
}
 
开发者ID:release-engineering,项目名称:pom-manipulation-ext,代码行数:35,代码来源:Project.java

示例11: expandPluginConfiguration

import org.apache.maven.model.PluginManagement; //导入依赖的package包/类
public void expandPluginConfiguration( Model model, ModelBuildingRequest request, ModelProblemCollector problems )
{
    Build build = model.getBuild();

    if ( build != null )
    {
        expand( build.getPlugins() );

        PluginManagement pluginManagement = build.getPluginManagement();

        if ( pluginManagement != null )
        {
            expand( pluginManagement.getPlugins() );
        }
    }
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:17,代码来源:DefaultPluginConfigurationExpander.java

示例12: updatePluginManagement

import org.apache.maven.model.PluginManagement; //导入依赖的package包/类
/**
 * Method updatePluginManagement
 *
 * @param value
 * @param element
 * @param counter
 * @param xmlTag
 */
protected void updatePluginManagement( PluginManagement value, String xmlTag, Counter counter, Element element )
{
    boolean shouldExist = value != null;
    Element root = updateElement( counter, element, xmlTag, shouldExist );
    if ( shouldExist )
    {
        Counter innerCount = new Counter( counter.getDepth() + 1 );
        iteratePlugin( innerCount, root, value.getPlugins(), "plugins", "plugin" );
    }
}
 
开发者ID:javiersigler,项目名称:apache-maven-shade-plugin,代码行数:19,代码来源:MavenJDOMWriter.java

示例13: getSnapshotsFromManagement

import org.apache.maven.model.PluginManagement; //导入依赖的package包/类
private Set<ArtifactCoordinates> getSnapshotsFromManagement(MavenProject project,
    PomPropertyResolver propertyResolver) {
  this.log.debug("\t\tChecking managed plugins");
  Build build = project.getBuild();
  if (build != null) {
    PluginManagement pluginManagement = build.getPluginManagement();
    if (pluginManagement != null) {
      Collection<Plugin> snapshots = Collections2.filter(pluginManagement.getPlugins(),
          new IsSnapshotPlugin(propertyResolver));
      return Sets.newHashSet(Collections2.transform(snapshots, PluginToCoordinates.INSTANCE));
    }
  }
  return Collections.emptySet();
}
 
开发者ID:shillner,项目名称:unleash-maven-plugin,代码行数:15,代码来源:CheckPluginVersions.java

示例14: createParentProject

import org.apache.maven.model.PluginManagement; //导入依赖的package包/类
private MavenProject createParentProject() {
    final MavenProject project = createMavenProject( "company", "company-parent-pom" );
    final Build build = new Build();
    build.setPluginManagement( new PluginManagement() );
    final Plugin plugin = newPlugin( "org.apache.maven.plugins", "maven-enforcer-plugin", "1.0");
    final Xpp3Dom configuration = createPluginConfiguration();
    plugin.setConfiguration( configuration );
    build.addPlugin( plugin );
    project.getOriginalModel().setBuild( build );
    return project;
}
 
开发者ID:mojohaus,项目名称:extra-enforcer-rules,代码行数:12,代码来源:RequirePropertyDivergesTest.java

示例15: get

import org.apache.maven.model.PluginManagement; //导入依赖的package包/类
@Override
public PluginManagement get( Model model )
{
    if ( model.getBuild() == null )
    {
        return null;
    }
    return model.getBuild().getPluginManagement();
}
 
开发者ID:mojohaus,项目名称:flatten-maven-plugin,代码行数:10,代码来源:PomProperty.java


注:本文中的org.apache.maven.model.PluginManagement类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。