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


Java PluginExecution.getConfiguration方法代码示例

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


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

示例1: getGeneratedSourceDirectory

import org.apache.maven.model.PluginExecution; //导入方法依赖的package包/类
/**
 * @param project Maven project
 * @return generated sources directory retrieved from ANTLR plugin's configuration
 */
private String getGeneratedSourceDirectory(MavenProject project) {
    Plugin buildHelper = getPlugin(project);
    if (buildHelper == null) {
        return getDefaultGeneratedSourceDirectory(project);
    }

    for (PluginExecution pluginExecution : buildHelper.getExecutions()) {
        Object configuration = pluginExecution.getConfiguration();
        if (configuration == null || !(configuration instanceof Xpp3Dom)) {
            continue;
        }
        Xpp3Dom xmlConfiguration = (Xpp3Dom) configuration;
        Xpp3Dom outputDirectory = xmlConfiguration.getChild("outputDirectory");
        if (outputDirectory != null) {
            return PathUtil.CWD.resolve(outputDirectory.getValue()).toAbsolutePath().toString();
        }
    }
    return getDefaultGeneratedSourceDirectory(project);
}
 
开发者ID:sourcegraph,项目名称:srclib-java,代码行数:24,代码来源:Antlr4MavenPlugin.java

示例2: expand

import org.apache.maven.model.PluginExecution; //导入方法依赖的package包/类
private void expand( List<Plugin> plugins )
{
    for ( Plugin plugin : plugins )
    {
        Xpp3Dom pluginConfiguration = (Xpp3Dom) plugin.getConfiguration();

        if ( pluginConfiguration != null )
        {
            for ( PluginExecution execution : plugin.getExecutions() )
            {
                Xpp3Dom executionConfiguration = (Xpp3Dom) execution.getConfiguration();

                executionConfiguration =
                    Xpp3Dom.mergeXpp3Dom( executionConfiguration, new Xpp3Dom( pluginConfiguration ) );

                execution.setConfiguration( executionConfiguration );
            }
        }
    }
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:21,代码来源:DefaultPluginConfigurationExpander.java

示例3: getBuildPluginConfigurationForGoal

import org.apache.maven.model.PluginExecution; //导入方法依赖的package包/类
/**
 * Retrieves the configuration for a specific goal of the given plugin from the Maven Project.
 *
 * @param mojo   the mojo
 * @param plugin the artifact id of the plugin
 * @param goal   the goal
 * @return the configuration, {@code null} if not found
 */
public static Xpp3Dom getBuildPluginConfigurationForGoal(AbstractWisdomMojo mojo, String plugin, String goal) {
    List<Plugin> plugins = mojo.project.getBuildPlugins();
    for (Plugin plug : plugins) {
        if (plug.getArtifactId().equals(plugin)) {
            // Check main execution
            List<String> globalGoals = (List<String>) plug.getGoals();
            if (globalGoals != null && globalGoals.contains(goal)) {
                return (Xpp3Dom) plug.getConfiguration();
            }
            // Check executions
            for (PluginExecution execution : plug.getExecutions()) {
                if (execution.getGoals().contains(goal)) {
                    return (Xpp3Dom) execution.getConfiguration();
                }
            }
        }
    }
    // Not found.
    return null;
}
 
开发者ID:wisdom-framework,项目名称:wisdom,代码行数:29,代码来源:PluginExtractor.java

示例4: writePluginExecution

import org.apache.maven.model.PluginExecution; //导入方法依赖的package包/类
private void writePluginExecution(PluginExecution pluginExecution, String tagName, XmlSerializer serializer)
        throws java.io.IOException {
    serializer.startTag(NAMESPACE, tagName);
    flush(serializer);
    StringBuffer b = b(serializer);
    int start = b.length();
    if ((pluginExecution.getId() != null) && !pluginExecution.getId().equals("default")) {
        writeValue(serializer, "id", pluginExecution.getId(), pluginExecution);
    }
    if (pluginExecution.getPhase() != null) {
        writeValue(serializer, "phase", pluginExecution.getPhase(), pluginExecution);
    }
    if ((pluginExecution.getGoals() != null) && (pluginExecution.getGoals().size() > 0)) {
        serializer.startTag(NAMESPACE, "goals");
        flush(serializer);
        int start2 = b.length();
        int index = 0;
        InputLocation tracker = pluginExecution.getLocation("goals");

        for (Iterator iter = pluginExecution.getGoals().iterator(); iter.hasNext();) {
            String goal = (String) iter.next();
            writeValue(serializer, "goal", goal, tracker, index);
            index = index + 1;
        }
        serializer.endTag(NAMESPACE, "goals").flush();
        logLocation(pluginExecution, "goals", start2, b.length());
    }
    if (pluginExecution.getInherited() != null) {
        writeValue(serializer, "inherited", pluginExecution.getInherited(), pluginExecution);
    }
    if (pluginExecution.getConfiguration() != null) {
        writeXpp3DOM(serializer, (Xpp3Dom)pluginExecution.getConfiguration(), pluginExecution);
    }
    serializer.endTag(NAMESPACE, tagName).flush();
    logLocation(pluginExecution, "", start, b.length());
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:37,代码来源:LocationAwareMavenXpp3Writer.java

示例5: isRuleInConfiguration

import org.apache.maven.model.PluginExecution; //导入方法依赖的package包/类
private boolean isRuleInConfiguration(PluginExecution execution, String ruleName) {
    final Xpp3Dom configuration = (Xpp3Dom) execution.getConfiguration();
    final Xpp3Dom rules = configuration.getChild("rules");
    if (rules != null && rules.getChild(ruleName) != null) {
        return true;
    }
    return false;
}
 
开发者ID:1and1,项目名称:ono-extra-enforcer-rules,代码行数:9,代码来源:AbstractRule.java

示例6: apply

import org.apache.maven.model.PluginExecution; //导入方法依赖的package包/类
/**
 * Updates project compile source roots with "sources" of Codehaus templating plugin configuration
 */
@Override
public void apply(MavenProject project,
                  File repoDir) {

    Plugin buildHelper = getPlugin(project);
    if (buildHelper == null) {
        return;
    }

    File root = project.getModel().getProjectDirectory();
    for (PluginExecution pluginExecution : buildHelper.getExecutions()) {
        Object configuration = pluginExecution.getConfiguration();
        if (configuration == null || !(configuration instanceof Xpp3Dom)) {
            project.getCompileSourceRoots().add(PathUtil.concat(project.getModel().getProjectDirectory(),
                    "src/main/java-templates").getPath());
            continue;
        }
        Xpp3Dom xmlConfiguration = (Xpp3Dom) configuration;
        Xpp3Dom sourceDirDom = xmlConfiguration.getChild("sourceDirectory");
        if (sourceDirDom == null) {
            project.getCompileSourceRoots().add(PathUtil.concat(project.getModel().getProjectDirectory(),
                    "src/main/java-templates").getPath());
        } else {
            project.getCompileSourceRoots().add(PathUtil.CWD.resolve(sourceDirDom.getValue()).toString());
        }
    }
}
 
开发者ID:sourcegraph,项目名称:srclib-java,代码行数:31,代码来源:CodehausTemplatingMavenPlugin.java

示例7: apply

import org.apache.maven.model.PluginExecution; //导入方法依赖的package包/类
/**
 * Updates project compile source roots with "sources" of Codehaus buold helper plugin configuration
 */
@Override
public void apply(MavenProject project,
                  File repoDir) {

    Plugin buildHelper = getPlugin(project);
    if (buildHelper == null) {
        return;
    }

    File root = project.getModel().getProjectDirectory();
    for (PluginExecution pluginExecution : buildHelper.getExecutions()) {
        Object configuration = pluginExecution.getConfiguration();
        if (configuration == null || !(configuration instanceof Xpp3Dom)) {
            continue;
        }
        Xpp3Dom xmlConfiguration = (Xpp3Dom) configuration;
        Xpp3Dom sourcesList[] = xmlConfiguration.getChildren("sources");
        if (sourcesList == null) {
            continue;
        }
        for (Xpp3Dom sources : sourcesList) {
            Xpp3Dom sourceList[] = sources.getChildren("source");
            if (sourceList == null) {
                continue;
            }
            for (Xpp3Dom source : sourceList) {
                project.getCompileSourceRoots().add(PathUtil.CWD.resolve(source.getValue()).toString());
            }
        }
    }
}
 
开发者ID:sourcegraph,项目名称:srclib-java,代码行数:35,代码来源:CodehausBuildHelperMavenPlugin.java

示例8: isAddon

import org.apache.maven.model.PluginExecution; //导入方法依赖的package包/类
/**
 * Returns <code>true</code> if this model is a single-project addon
 */
public boolean isAddon(Model model)
{
   boolean result = false;
   Build build = model.getBuild();
   if (build != null)
   {
      PLUGIN_LOOP: for (Plugin plugin : build.getPlugins())
      {
         if ("maven-jar-plugin".equals(plugin.getArtifactId()))
         {
            for (PluginExecution execution : plugin.getExecutions())
            {
               Xpp3Dom config = (Xpp3Dom) execution.getConfiguration();
               if (config != null)
               {
                  Xpp3Dom classifierNode = config.getChild("classifier");
                  if (classifierNode != null
                           && MavenAddonDependencyResolver.FORGE_ADDON_CLASSIFIER.equals(classifierNode.getValue()))
                  {
                     result = true;
                     break PLUGIN_LOOP;
                  }
               }
            }
         }
      }
   }
   return result;
}
 
开发者ID:forge,项目名称:furnace,代码行数:33,代码来源:ProjectHelper.java

示例9: mergePluginExecutionDefinitions

import org.apache.maven.model.PluginExecution; //导入方法依赖的package包/类
private static void mergePluginExecutionDefinitions( PluginExecution child, PluginExecution parent )
{
    if ( child.getPhase() == null )
    {
        child.setPhase( parent.getPhase() );
    }

    List<String> parentGoals = parent.getGoals();
    List<String> childGoals = child.getGoals();

    List<String> goals = new ArrayList<String>();

    if ( ( childGoals != null ) && !childGoals.isEmpty() )
    {
        goals.addAll( childGoals );
    }

    if ( parentGoals != null )
    {
        for (  String goal : parentGoals )
        {
            if ( !goals.contains( goal ) )
            {
                goals.add( goal );
            }
        }
    }

    child.setGoals( goals );

    Xpp3Dom childConfiguration = (Xpp3Dom) child.getConfiguration();
    Xpp3Dom parentConfiguration = (Xpp3Dom) parent.getConfiguration();

    childConfiguration = Xpp3Dom.mergeXpp3Dom( childConfiguration, parentConfiguration );

    child.setConfiguration( childConfiguration );
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:38,代码来源:ModelUtils.java

示例10: getBuildPluginConfiguration

import org.apache.maven.model.PluginExecution; //导入方法依赖的package包/类
/**
 * Retrieves the main configuration of the given plugin from the Maven Project.
 *
 * @param mojo       the mojo
 * @param artifactId the artifact id of the plugin
 * @param goal       an optional goal. If set if first check for a specific configuration executing this
 *                   goal, if not found, it returns the global configuration
 * @return the configuration, {@code null} if not found
 */
public static Xpp3Dom getBuildPluginConfiguration(AbstractWisdomMojo mojo, String artifactId, String goal) {
    List<Plugin> plugins = mojo.project.getBuildPlugins();

    Plugin plugin = null;
    for (Plugin plug : plugins) {
        if (plug.getArtifactId().equals(artifactId)) {
            plugin = plug;
        }
    }

    if (plugin == null) {
        // Not found
        return null;
    }

    if (goal != null) {
        // Check main execution
        List<String> globalGoals = (List<String>) plugin.getGoals();
        if (globalGoals != null && globalGoals.contains(goal)) {
            return (Xpp3Dom) plugin.getConfiguration();
        }
        // Check executions
        for (PluginExecution execution : plugin.getExecutions()) {
            if (execution.getGoals().contains(goal)) {
                return (Xpp3Dom) execution.getConfiguration();
            }
        }
    }
    // Global configuration.
    return (Xpp3Dom) plugin.getConfiguration();
}
 
开发者ID:wisdom-framework,项目名称:wisdom,代码行数:41,代码来源:PluginExtractor.java

示例11: findSkipRefs

import org.apache.maven.model.PluginExecution; //导入方法依赖的package包/类
/**
 * Go through the plugin / plugin-execution configurations and find references to the <code>skip</code> parameter for the given Maven plugin
 * instance.
 */
private List<SkipReference> findSkipRefs( final Plugin plugin, final Project project )
    throws ManipulationException
{
    if ( plugin == null )
    {
        return Collections.emptyList();
    }

    final Map<ConfigurationContainer, String> configs = new LinkedHashMap<>();
    Object configuration = plugin.getConfiguration();
    if ( configuration != null )
    {
        configs.put( plugin, configuration.toString() );
    }

    final List<PluginExecution> executions = plugin.getExecutions();
    if ( executions != null )
    {
        for ( final PluginExecution execution : executions )
        {
            configuration = execution.getConfiguration();
            if ( configuration != null )
            {
                configs.put( execution, configuration.toString() );
            }
        }
    }

    final List<SkipReference> result = new ArrayList<>();
    for ( final Map.Entry<ConfigurationContainer, String> entry : configs.entrySet() )
    {
        try
        {
            final Document doc = galleyWrapper.parseXml( entry.getValue() );
            final NodeList children = doc.getDocumentElement()
                                         .getChildNodes();
            if ( children != null )
            {
                for ( int i = 0; i < children.getLength(); i++ )
                {
                    final Node n = children.item( i );
                    if ( n.getNodeName()
                          .equals( SKIP_NODE ) )
                    {
                        result.add( new SkipReference( entry.getKey(), n ) );
                    }
                }
            }
        }
        catch ( final GalleyMavenXMLException e )
        {
            throw new ManipulationException( "Unable to parse config for plugin: %s in: %s", e, plugin.getId(),
                                             project.getId() );
        }
    }

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


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