Package org.apache.maven.model

Examples of org.apache.maven.model.Plugin


      Coordinate compiler = mavenCompilerPlugin();
      MavenPluginBuilder builder = MavenPluginBuilder.create()
               .setCoordinate(compiler);

      // when
      Plugin plugin = new MavenPluginAdapter(builder);

      // then
      assertEquals(compiler.getGroupId(), plugin.getGroupId());
      assertEquals(compiler.getArtifactId(), plugin.getArtifactId());
      assertEquals(compiler.getVersion(), plugin.getVersion());
      assertNull(plugin.getExtensions());
   }
View Full Code Here


                        ConfigurationBuilder.create()
                                 .addConfigurationElement(ConfigurationElementBuilder.create()
                                          .addChild("test").setText("content")));

      // when
      Plugin plugin = new MavenPluginAdapter(builder);

      // then
      assertNotNull(plugin.getConfiguration());
      assertNotNull(((Xpp3Dom) plugin.getConfiguration()).getChild("test"));
   }
View Full Code Here

      // given
      MavenPluginBuilder builder = MavenPluginBuilder.create()
               .setCoordinate(mavenCompilerPlugin())
               .setExtensions(true);
      // when
      Plugin plugin = new MavenPluginAdapter(builder);

      // then
      assertNotNull(plugin.getExtensions());
   }
View Full Code Here

      MavenPluginBuilder builder = MavenPluginBuilder.create()
               .setCoordinate(mavenCompilerPlugin())
               .addPluginDependency(groovyCompiler());

      // when
      Plugin plugin = new MavenPluginAdapter(builder);

      // then
      List<org.apache.maven.model.Dependency> dependencies = plugin.getDependencies();
      assertNotNull(dependencies);
      assertEquals(1, dependencies.size());
      org.apache.maven.model.Dependency dependency = dependencies.get(0);
      assertEquals("groovy-eclipse-compiler", dependency.getArtifactId());
      assertEquals("org.codehaus.groovy", dependency.getGroupId());
View Full Code Here

                        .addGoal("test")
                        .setId("testId")
                        .setPhase("test"));

      // when
      Plugin plugin = new MavenPluginAdapter(builder);

      // then
      assertFalse(plugin.getExecutions().isEmpty());
      PluginExecution execution = plugin.getExecutions().get(0);
      assertEquals("testId", execution.getId());
      assertFalse(execution.getGoals().isEmpty());
   }
View Full Code Here

         }
         else
         {
            // Create a new plugin management, that will handle the minimal configuration: groupId, artifactId and
            // version
            Plugin newManagedPlugin = new Plugin();
            newManagedPlugin.setGroupId(pluginToInstall.getGroupId());
            newManagedPlugin.setArtifactId(pluginToInstall.getArtifactId());
            newManagedPlugin.setVersion(pluginToInstall.getVersion());
            mavenManagedPlugin = new MavenPluginAdapter(newManagedPlugin);
         }

         // Install the plugin management, if needed
         addOrUpdatePlugin(deps, plugins, mavenManagedPlugin, true);
View Full Code Here

        return plugins;
    }

    private Plugin newPlugin( String artifactId, String... goals )
    {
        Plugin plugin = new Plugin();

        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

        if ( repositorySystem != null )
        {
            List<Plugin> plugins = getBuildPlugins();
            for ( Iterator<Plugin> i = plugins.iterator(); i.hasNext(); )
            {
                Plugin p = (Plugin) i.next();

                String version;
                if ( StringUtils.isEmpty( p.getVersion() ) )
                {
                    version = "RELEASE";
                }
                else
                {
                    version = p.getVersion();
                }

                Artifact artifact = repositorySystem.createPluginArtifact( p );

                if ( artifact == null )
View Full Code Here

                else
                {
                    version = p.getVersion();
                }

                Plugin pp = new Plugin();
                pp.setGroupId( p.getGroupId() );
                pp.setArtifactId( p.getArtifactId() );
                pp.setVersion( version );
                Artifact artifact = repositorySystem.createPluginArtifact( pp );

                if ( artifact != null )
                {
                    reportArtifacts.add( artifact );
View Full Code Here

            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 )
            {
                plugin.setVersion( p[2] );
            }

            Plugin existing = plugins.get( plugin );
            if ( existing != null )
            {
                if ( existing.getVersion() == null )
                {
                    existing.setVersion( plugin.getVersion() );
                }
                plugin = existing;
            }
            else
            {
View Full Code Here

TOP

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

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.