Package org.jboss.forge.addon.maven.plugins

Examples of org.jboss.forge.addon.maven.plugins.MavenPlugin


      MavenPluginFacet mavenPluginFacet = project.getFacet(MavenPluginFacet.class);
      final String webappFolderName;
      Coordinate mvnWarPluginDep = CoordinateBuilder.create("org.apache.maven.plugins:maven-war-plugin");
      if (mavenPluginFacet.hasPlugin(mvnWarPluginDep))
      {
         MavenPlugin warPlugin = mavenPluginFacet.getPlugin(mvnWarPluginDep);
         Configuration config = warPlugin.getConfig();
         if (config.hasConfigurationElement("warSourceDirectory"))
         {
            webappFolderName = config.getConfigurationElement("warSourceDirectory").getText();
         }
         else
View Full Code Here


         MavenPluginFacet plugins = getFaceted().getFacet(MavenPluginFacet.class);
         Coordinate mvnWarPluginDep = CoordinateBuilder.create().setGroupId("org.apache.maven.plugins")
                  .setArtifactId("maven-war-plugin")
                  .setVersion("2.4");

         MavenPlugin plugin;
         if (!plugins.hasPlugin(mvnWarPluginDep))
         {
            plugin = MavenPluginBuilder.create().setCoordinate(mvnWarPluginDep);
            plugins.addPlugin(plugin);
         }
         else
         {
            plugin = plugins.getPlugin(mvnWarPluginDep);
         }

         if (!plugin.getConfig().hasConfigurationElement("failOnMissingWebXml"))
         {
            plugin.getConfig().addConfigurationElement(
                     ConfigurationElementBuilder.create().setName("failOnMissingWebXml").setText("false"));
         }
         else
         {
            ConfigurationElementBuilder configElement = ConfigurationElementBuilder.createFromExisting(plugin
                     .getConfig().getConfigurationElement("failOnMissingWebXml"));
            plugin.getConfig().removeConfigurationElement("failOnMissingWebXml");
            plugin.getConfig().addConfigurationElement(configElement);
         }

         plugins.removePlugin(mvnWarPluginDep);
         plugins.addPlugin(plugin);
      }
View Full Code Here

   {
      MavenPluginFacet plugins = project.getFacet(MavenPluginFacet.class);
      DependencyFacet deps = project.getFacet(DependencyFacet.class);
      Coordinate pluginCoordinates = CoordinateBuilder.create().setGroupId(plugin.getCoordinate().getGroupId())
               .setArtifactId(plugin.getCoordinate().getArtifactId());
      MavenPlugin managedPlugin = null;
      if (plugins.hasManagedPlugin(pluginCoordinates))
      {
         managedPlugin = plugins.getManagedPlugin(pluginCoordinates);
      }

      MavenPlugin existing = null;
      // existing represents the plugin(management) as it exists currently throughout the entire hierarchy
      if (managed && plugins.hasEffectiveManagedPlugin(pluginCoordinates))
      {
         existing = plugins.getEffectiveManagedPlugin(pluginCoordinates);
         if (plugins.hasManagedPlugin(pluginCoordinates) && !mergeWithExisting)
         {
            // If no merge, existing should not have any of the direct managed-plugin configuration
            existing = diff(existing, plugins.getManagedPlugin(pluginCoordinates));
         }
      }
      else if (plugins.hasEffectivePlugin(pluginCoordinates))
      {
         existing = plugins.getEffectivePlugin(pluginCoordinates);
         if (plugins.hasPlugin(pluginCoordinates) && !mergeWithExisting)
         {
            // If no merge, existing should not have any of the direct plugin configuration
            existing = diff(existing, plugins.getPlugin(pluginCoordinates));
         }
      }

      MavenPlugin filteredPlugin = plugin;
      // The filtered plugin preserve the hierarchy, by preventing installing properties already defined with the same
      // values
      if (existing != null && preserveHierarchyPrecedence)
      {
         filteredPlugin = diff(plugin, existing);
      }
      // Preserve direct plugin-management inheritance
      if (!managed && managedPlugin != null)
      {
         // The plugin section does not exists but a plugin management section in the direct pom does
         filteredPlugin = diff(filteredPlugin, managedPlugin);
      }

      MavenPlugin mergedPlugin = filteredPlugin;
      // merged plugin is a merge with the direct plugin(management)
      if (mergeWithExisting)
      {
         if (managed && managedPlugin != null)
         {
            mergedPlugin = plugins.merge(mergedPlugin, managedPlugin);
         }
         else if (!managed && plugins.hasPlugin(pluginCoordinates))
         {
            mergedPlugin = plugins.merge(mergedPlugin, plugins.getPlugin(pluginCoordinates));
         }
      }

      // Resolve version
      String versionToInstall = plugin.getCoordinate().getVersion();
      if (mergedPlugin.getCoordinate().getVersion() == null)
      {
         // null version means no version was specified or already defined in the hierarchy
         if (versionToInstall == null)
         {
            versionToInstall = promptVersion(deps, pluginCoordinates, null).getVersion();
View Full Code Here

   }

   private void removePlugin(final Coordinate dependency, boolean managedPlugin)
   {
      // Get plugin
      MavenPlugin pluginToRemove = null;
      if (managedPlugin && hasManagedPlugin(dependency))
      {
         pluginToRemove = getManagedPlugin(dependency);
      }
      else if (hasPlugin(dependency))
View Full Code Here

      if (Strings.isNullOrEmpty(aptDependency.getVersion()))
      {
         aptDependency = getLatestVersion(aptDependency);
      }

      final MavenPlugin processorPlugin = MavenPluginBuilder.create()
               .setCoordinate(versioned)
               .addExecution(execution)
               .addPluginDependency(DependencyBuilder.create().setCoordinate(aptDependency));
      facet.addPlugin(processorPlugin);
      // FORGE-700
View Full Code Here

   {
      Coordinate compilerDependency = CoordinateBuilder.create()
               .setGroupId("org.apache.maven.plugins")
               .setArtifactId("maven-compiler-plugin");
      MavenPluginFacet pluginFacet = getFaceted().getFacet(MavenPluginFacet.class);
      final MavenPlugin compiler;
      if (pluginFacet.hasPlugin(compilerDependency))
      {
         compiler = pluginFacet.getPlugin(compilerDependency);
      }
      else
      {
         compiler = MavenPluginBuilder.create().setCoordinate(compilerDependency);
      }
      Configuration config = compiler.getConfig();
      if (!config.hasConfigurationElement("proc"))
      {
         ConfigurationElement proc = ConfigurationBuilder.create().createConfigurationElement("proc").setText("none");
         config.addConfigurationElement(proc);
      }
View Full Code Here

   {
      CoordinateBuilder dependency = createProcessorCoordinate().setVersion(null);
      MavenPluginFacet pluginFacet = getFaceted().getFacet(MavenPluginFacet.class);
      if (pluginFacet.hasPlugin(dependency))
      {
         MavenPlugin plugin = pluginFacet.getPlugin(dependency);
         if (plugin.listExecutions().size() > 0)
         {
            Configuration config = plugin.listExecutions().get(0).getConfig();
            if (config.hasConfigurationElement("processors"))
            {
               ConfigurationElement element = config.getConfigurationElement("processors").getChildByName("processor");
               return element.getText().equals(provider.getProcessor());
            }
View Full Code Here

   {
      MavenPluginFacet plugins = project.getFacet(MavenPluginFacet.class);
      DependencyFacet deps = project.getFacet(DependencyFacet.class);
      Coordinate pluginCoordinates = CoordinateBuilder.create().setGroupId(plugin.getCoordinate().getGroupId())
               .setArtifactId(plugin.getCoordinate().getArtifactId());
      MavenPlugin managedPlugin = null;
      if (plugins.hasManagedPlugin(pluginCoordinates))
      {
         managedPlugin = plugins.getManagedPlugin(pluginCoordinates);
      }

      MavenPlugin existing = null;
      // existing represents the plugin(management) as it exists currently throughout the entire hierarchy
      if (managed && plugins.hasEffectiveManagedPlugin(pluginCoordinates))
      {
         existing = plugins.getEffectiveManagedPlugin(pluginCoordinates);
      }
      else if (plugins.hasEffectivePlugin(pluginCoordinates))
      {
         existing = plugins.getEffectivePlugin(pluginCoordinates);
      }

      MavenPlugin filteredPlugin = plugin;
      // The filtered plugin preserve the hierarchy, by preventing installing properties already defined with the same
      // values
      if (existing != null && preserveHierarchyPrecedence)
      {
         filteredPlugin = diff(plugin, existing);
      }
      // Preserve direct plugin-management inheritance
      if (!managed && managedPlugin != null)
      {
         // The plugin section does not exists but a plugin management section in the direct pom does
         filteredPlugin = diff(filteredPlugin, managedPlugin);
      }

      MavenPlugin mergedPlugin = filteredPlugin;
      // merged plugin is a merge with the direct plugin(management)
      if (managed && managedPlugin != null)
      {
         mergedPlugin = plugins.merge(mergedPlugin, managedPlugin);
      }
      else if (!managed && plugins.hasPlugin(pluginCoordinates))
      {
         mergedPlugin = plugins.merge(mergedPlugin, plugins.getPlugin(pluginCoordinates));
      }

      // Resolve version
      String versionToInstall = plugin.getCoordinate().getVersion();
      if (mergedPlugin.getCoordinate().getVersion() == null)
      {
         // null version means no version was specified or already defined in the hierarchy
         if (versionToInstall == null)
         {
            versionToInstall = promptVersion(deps, pluginCoordinates, null).getVersion();
View Full Code Here

TOP

Related Classes of org.jboss.forge.addon.maven.plugins.MavenPlugin

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.