Package org.apache.maven.model

Examples of org.apache.maven.model.PluginExecution


        PluginDescriptor pluginDescriptor = descriptor.getPluginDescriptor();
        Map pluginMap = project.getBuild().getPluginsAsMap();
        Plugin plugin = (Plugin)pluginMap.get(pluginDescriptor.getGroupId() + ":" + pluginDescriptor.getArtifactId());
        // How to get the current execution id?
        for (Iterator i = plugin.getExecutions().iterator(); i.hasNext();) {
            PluginExecution execution = (PluginExecution)i.next();
            String phase = execution.getPhase();
            if (phase != null && phase.indexOf("-test-") != -1) {
                project.addTestCompileSourceRoot(targetDirectory);
            } else {
                project.addCompileSourceRoot(targetDirectory);
            }
View Full Code Here


                List executions = plugin.getExecutions();

                // a different source/target version can be configured for test sources compilation
                for (Iterator iter = executions.iterator(); iter.hasNext(); ) {
                    PluginExecution execution = (PluginExecution) iter.next();

                    // TODO: This may cause ClassCastExceptions eventually, if the dom impls differ.
                    o = (Xpp3Dom) execution.getConfiguration();

                    if (o != null && o.getChild(optionName) != null) {
                        value = o.getChild(optionName).getValue();
                    }
                }
View Full Code Here

        PluginDescriptor pluginDescriptor = descriptor.getPluginDescriptor();
        Map pluginMap = project.getBuild().getPluginsAsMap();
        Plugin plugin = (Plugin)pluginMap.get(pluginDescriptor.getGroupId() + ":" + pluginDescriptor.getArtifactId());
        // How to get the current execution id?
        for (Iterator i = plugin.getExecutions().iterator(); i.hasNext();) {
            PluginExecution execution = (PluginExecution)i.next();
            String phase = execution.getPhase();
            if (phase != null && phase.indexOf("-test-") != -1) {
                project.addTestCompileSourceRoot(targetDirectory);
            } else {
                project.addCompileSourceRoot(targetDirectory);
            }
View Full Code Here

                elIt = null;
            }
            Counter innerCount = new Counter( counter.getDepth() + 1 );
            while ( it.hasNext() )
            {
                PluginExecution value = (PluginExecution) it.next();
                Element el;
                if ( elIt != null && elIt.hasNext() )
                {
                    el = (Element) elIt.next();
                    if ( !elIt.hasNext() )
View Full Code Here

      Plugin plugin = new Plugin();
      plugin.setArtifactId("maven-dependency-plugin");
      plugin.setExtensions(false);

      PluginExecution execution = new PluginExecution();
      execution.setId("unpack");
      execution.setPhase("process-test-classes");
      execution.addGoal("unpack");

      ConfigurationBuilder configBuilder = ConfigurationBuilder.create();
      ConfigurationElementBuilder artifactItem = configBuilder
               .createConfigurationElement("artifactItems").addChild("artifactItem");
      artifactItem.addChild("groupId").setText("org.jboss.as");
      artifactItem.addChild("artifactId").setText("jboss-as-dist");
      artifactItem.addChild("version").setText("7.1.0.CR1b");
      artifactItem.addChild("type").setText("zip");
      artifactItem.addChild("outputDirectory").setText("target/");
      try {
         new Xpp3DomBuilder();
         execution.setConfiguration(
                  Xpp3DomBuilder.build(new ByteArrayInputStream(configBuilder.toString().getBytes()), "UTF-8"));
      }
      catch (XmlPullParserException e) {
         throw new RuntimeException(e);
      }
View Full Code Here

   private List<PluginExecution> transformExecutions(final MavenPlugin mavenPlugin)
   {
      List<PluginExecution> executions = new ArrayList<PluginExecution>();

      for (Execution execution : mavenPlugin.listExecutions()) {
         PluginExecution pluginExecution = new PluginExecution();
         pluginExecution.setId(execution.getId());
         pluginExecution.setPhase(execution.getPhase());
         pluginExecution.setGoals(execution.getGoals());
         pluginExecution.setConfiguration(parseConfig(execution.getConfig()));

         executions.add(pluginExecution);
      }

      return executions;
View Full Code Here

        //Try to get the value for the Surefire config for the "integration-test", if there is one
        //but default to the global config otherwise
        List executions = surefirePlugin.getExecutions();
        for (int i = 0; i < executions.size(); i++) {
            PluginExecution execution = (PluginExecution) executions.get(i);
            if ("integration-test".equals(execution.getPhase())) {
                Xpp3Dom config = (Xpp3Dom) execution.getConfiguration();
                value = config == null ? null : extractNestedStrings(elementName, config);
                break;
            }
        }
View Full Code Here

        plugin.setGroupId( "org.apache.maven.plugins" );
        plugin.setArtifactId( artifactId );

        for ( String goal : goals )
        {
            PluginExecution pluginExecution = new PluginExecution();
            pluginExecution.setId( "default-" + goal );
            pluginExecution.addGoal( goal );
            plugin.addExecution( pluginExecution );
        }

        return plugin;
    }
View Full Code Here

        {
            // either <groupId>:<artifactId>:<goal> or <groupId>:<artifactId>:<version>:<goal>
            String goal = mojos[i].trim();
            String[] p = StringUtils.split( goal, ":" );

            PluginExecution execution = new PluginExecution();
            execution.setId( "default-" + p[p.length - 1] );
            execution.setPhase( phase );
            execution.setPriority( i - mojos.length );
            execution.getGoals().add( p[p.length - 1] );

            Plugin plugin = new Plugin();
            plugin.setGroupId( p[0] );
            plugin.setArtifactId( p[1] );
            if ( p.length >= 4 )
View Full Code Here

                {
                    dom = (Xpp3Dom) plugin.getConfiguration();

                    if ( executionId != null )
                    {
                        PluginExecution execution = plugin.getExecutionsAsMap().get( executionId );
                        if ( execution != null )
                        {
                            // NOTE: The PluginConfigurationExpander already merged the plugin-level config in
                            dom = (Xpp3Dom) execution.getConfiguration();
                        }
                    }
                    break;
                }
            }
View Full Code Here

TOP

Related Classes of org.apache.maven.model.PluginExecution

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.