Package org.jboss.forge.maven.plugins

Examples of org.jboss.forge.maven.plugins.Configuration


      Dependency compilerDependency = DependencyBuilder.create()
               .setGroupId("org.apache.maven.plugins")
               .setArtifactId("maven-compiler-plugin");
      MavenPluginFacet pluginFacet = project.getFacet(MavenPluginFacet.class);
      MavenPlugin compiler = pluginFacet.getPlugin(compilerDependency);
      Configuration config = compiler.getConfig();
      if (!config.hasConfigurationElement("proc"))
      {
         ConfigurationElement proc = ConfigurationBuilder.create().createConfigurationElement("proc").setText("none");
         config.addConfigurationElement(proc);
      }
      pluginFacet.updatePlugin(compiler);
   }
View Full Code Here


      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());
            }
         }
      }
      return false;
View Full Code Here

      Dependency compilerDependency = DependencyBuilder.create()
               .setGroupId("org.apache.maven.plugins")
               .setArtifactId("maven-compiler-plugin");
      MavenPluginFacet pluginFacet = project.getFacet(MavenPluginFacet.class);
      MavenPlugin compiler = pluginFacet.getPlugin(compilerDependency);
      Configuration config = compiler.getConfig();
      if (!config.hasConfigurationElement("proc"))
      {
         ConfigurationElement proc = ConfigurationBuilder.create().createConfigurationElement("proc").setText("none");
         config.addConfigurationElement(proc);
         ((MavenPluginAdapter)compiler).setConfig(config);
      }
      pluginFacet.updatePlugin(compiler);
   }
View Full Code Here

      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());
            }
         }
      }
      return false;
View Full Code Here

            // Remove extension as dominant and recessive have the same one
            merged.setExtensions(null);
         }
         // Config
         Map<String, String> cfgElmtsRefMap = new HashMap<String, String>();
         Configuration mergedConfiguration = merged.getConfig();
         if (dominant.getConfig() != null && recessive.getConfig() != null)
         {
            for (ConfigurationElement e : dominant.getConfig().listConfigurationElements())
            {
               // FIXME: recursively do a diff of childrens, if any
               cfgElmtsRefMap.put(e.getName(), e.toString());
            }
            for (ConfigurationElement e : recessive.getConfig().listConfigurationElements())
            {
               if (cfgElmtsRefMap.containsKey(e.getName()))
               {
                  if (Strings.areEqual(cfgElmtsRefMap.get(e.getName()), e.toString()))
                  {
                     // Remove the configuration element as dominant and recessive have the same element
                     mergedConfiguration.removeConfigurationElement(e.getName());
                  }
               }
            }
         }
         merged.setConfig(mergedConfiguration);
         // Executions
         Map<String, PluginExecution> dominantExec = new MavenPluginAdapter(dominant).getExecutionsAsMap();
         Map<String, PluginExecution> recessiveExec = new MavenPluginAdapter(recessive).getExecutionsAsMap();
         Map<String, PluginExecution> mergedExec = merged.getExecutionsAsMap();
         if (dominantExec != null && recessiveExec != null)
         {
            for (Map.Entry<String, PluginExecution> entry : recessiveExec.entrySet())
            {
               PluginExecution pluginExecutionRecessive = entry.getValue();
               PluginExecution pluginExecutionDominant = dominantExec.get(entry.getKey());
               if (pluginExecutionRecessive != null && pluginExecutionDominant != null)
               {
                  PluginExecution pluginExecutionMerged = mergedExec.get(entry.getKey());
                  // Phase
                  if (Strings.areEqual(pluginExecutionRecessive.getPhase(), pluginExecutionDominant.getPhase()))
                  {
                     // Remove the phase as dominant and recessive are identical
                     pluginExecutionMerged.setPhase(null);
                  }
                  // Goals
                  Map<String, Boolean> hasGoals = new HashMap<String, Boolean>();
                  for (String goal : pluginExecutionRecessive.getGoals())
                  {
                     hasGoals.put(goal, new Boolean(true));
                  }
                  for (String goal : pluginExecutionDominant.getGoals())
                  {
                     if (hasGoals.get(goal))
                     {
                        // Remove the goal as dominant and recessive have the same goal
                        pluginExecutionMerged.removeGoal(goal);
                     }
                  }
                  // Configurations
                  Map<String, String> cfgExecElmtsRefMap = new HashMap<String, String>();
                  if (pluginExecutionRecessive.getConfiguration() != null
                           && pluginExecutionDominant.getConfiguration() != null)
                  {
                     Configuration pluginExecutionRecessiveCfg = new ConfigurationImpl(
                              (Xpp3Dom) pluginExecutionRecessive.getConfiguration());
                     Configuration pluginExecutionDominantCfg = new ConfigurationImpl(
                              (Xpp3Dom) pluginExecutionDominant.getConfiguration());
                     Configuration pluginExecutionMergedCfg = new ConfigurationImpl(
                              (Xpp3Dom) pluginExecutionMerged.getConfiguration());

                     for (ConfigurationElement e : pluginExecutionDominantCfg.listConfigurationElements())
                     {
                        // FIXME: recursively do a diff of childrens, if any
                        cfgExecElmtsRefMap.put(e.getName(), e.toString());
                     }
                     for (ConfigurationElement e : pluginExecutionRecessiveCfg.listConfigurationElements())
                     {
                        if (cfgExecElmtsRefMap.containsKey(e.getName()))
                        {
                           if (Strings.areEqual(cfgExecElmtsRefMap.get(e.getName()), e.toString()))
                           {
                              // Remove the execution configuration element as dominant and recessive have the same
                              // element
                              pluginExecutionMergedCfg.removeConfigurationElement(e.getName());
                           }
                        }
                     }
                     if (!pluginExecutionMergedCfg.hasConfigurationElements())
                     {
                        pluginExecutionMerged.setConfiguration(null);
                     }
                     try
                     {
                        pluginExecutionMerged.setConfiguration(Xpp3DomBuilder.build(
                                 new ByteArrayInputStream(pluginExecutionMergedCfg.toString().getBytes()), "UTF-8"));
                     }
                     catch (Exception ex)
                     {
                        throw new RuntimeException("Exception while parsing configuration", ex);
                     }
View Full Code Here

      Dependency compilerDependency = DependencyBuilder.create()
               .setGroupId("org.apache.maven.plugins")
               .setArtifactId("maven-compiler-plugin");
      MavenPluginFacet pluginFacet = project.getFacet(MavenPluginFacet.class);
      MavenPlugin compiler = pluginFacet.getPlugin(compilerDependency);
      Configuration config = compiler.getConfig();
      if (!config.hasConfigurationElement("proc"))
      {
         ConfigurationElement proc = ConfigurationBuilder.create().createConfigurationElement("proc").setText("none");
         config.addConfigurationElement(proc);
      }
      pluginFacet.updatePlugin(compiler);
   }
View Full Code Here

      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());
            }
         }
      }
      return false;
View Full Code Here

      final String webappFolderName;
      Dependency mvnWarPluginDep = DependencyBuilder.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
         {
            webappFolderName = "src" + File.separator + "main" + File.separator + "webapp";
         }
View Full Code Here

            // Remove extension as dominant and recessive have the same one
            merged.setExtensions(null);
         }
         // Config
         Map<String, String> cfgElmtsRefMap = new HashMap<String, String>();
         Configuration mergedConfiguration = merged.getConfig();
         if (dominant.getConfig() != null && recessive.getConfig() != null)
         {
            for (ConfigurationElement e : dominant.getConfig().listConfigurationElements())
            {
               // FIXME: recursively do a diff of childrens, if any
               cfgElmtsRefMap.put(e.getName(), e.toString());
            }
            for (ConfigurationElement e : recessive.getConfig().listConfigurationElements())
            {
               if (cfgElmtsRefMap.containsKey(e.getName()))
               {
                  if (Strings.areEqual(cfgElmtsRefMap.get(e.getName()), e.toString()))
                  {
                     // Remove the configuration element as dominant and recessive have the same element
                     mergedConfiguration.removeConfigurationElement(e.getName());
                  }
               }
            }
         }
         merged.setConfig(mergedConfiguration);
         // Executions
         Map<String, PluginExecution> dominantExec = new MavenPluginAdapter(dominant).getExecutionsAsMap();
         Map<String, PluginExecution> recessiveExec = new MavenPluginAdapter(recessive).getExecutionsAsMap();
         Map<String, PluginExecution> mergedExec = merged.getExecutionsAsMap();
         if (dominantExec != null && recessiveExec != null)
         {
            for (Map.Entry<String, PluginExecution> entry : recessiveExec.entrySet())
            {
               PluginExecution pluginExecutionRecessive = entry.getValue();
               PluginExecution pluginExecutionDominant = dominantExec.get(entry.getKey());
               if (pluginExecutionRecessive != null && pluginExecutionDominant != null)
               {
                  PluginExecution pluginExecutionMerged = mergedExec.get(entry.getKey());
                  // Phase
                  if (Strings.areEqual(pluginExecutionRecessive.getPhase(), pluginExecutionDominant.getPhase()))
                  {
                     // Remove the phase as dominant and recessive are identical
                     pluginExecutionMerged.setPhase(null);
                  }
                  // Goals
                  Map<String, Boolean> hasGoals = new HashMap<String, Boolean>();
                  for (String goal : pluginExecutionRecessive.getGoals())
                  {
                     hasGoals.put(goal, new Boolean(true));
                  }
                  for (String goal : pluginExecutionDominant.getGoals())
                  {
                     if (hasGoals.get(goal))
                     {
                        // Remove the goal as dominant and recessive have the same goal
                        pluginExecutionMerged.removeGoal(goal);
                     }
                  }
                  // Configurations
                  Map<String, String> cfgExecElmtsRefMap = new HashMap<String, String>();
                  if (pluginExecutionRecessive.getConfiguration() != null
                           && pluginExecutionDominant.getConfiguration() != null)
                  {
                     Configuration pluginExecutionRecessiveCfg = new ConfigurationImpl(
                              (Xpp3Dom) pluginExecutionRecessive.getConfiguration());
                     Configuration pluginExecutionDominantCfg = new ConfigurationImpl(
                              (Xpp3Dom) pluginExecutionDominant.getConfiguration());
                     Configuration pluginExecutionMergedCfg = new ConfigurationImpl(
                              (Xpp3Dom) pluginExecutionMerged.getConfiguration());

                     for (ConfigurationElement e : pluginExecutionDominantCfg.listConfigurationElements())
                     {
                        // FIXME: recursively do a diff of childrens, if any
                        cfgExecElmtsRefMap.put(e.getName(), e.toString());
                     }
                     for (ConfigurationElement e : pluginExecutionRecessiveCfg.listConfigurationElements())
                     {
                        if (cfgExecElmtsRefMap.containsKey(e.getName()))
                        {
                           if (Strings.areEqual(cfgExecElmtsRefMap.get(e.getName()), e.toString()))
                           {
                              // Remove the execution configuration element as dominant and recessive have the same
                              // element
                              pluginExecutionMergedCfg.removeConfigurationElement(e.getName());
                           }
                        }
                     }
                     if (!pluginExecutionMergedCfg.hasConfigurationElements())
                     {
                        pluginExecutionMerged.setConfiguration(null);
                     }
                     try
                     {
                        pluginExecutionMerged.setConfiguration(Xpp3DomBuilder.build(
                                 new ByteArrayInputStream(pluginExecutionMergedCfg.toString().getBytes()), "UTF-8"));
                     }
                     catch (Exception ex)
                     {
                        throw new RuntimeException("Exception while parsing configuration", ex);
                     }
View Full Code Here

      Dependency compilerDependency = DependencyBuilder.create()
               .setGroupId("org.apache.maven.plugins")
               .setArtifactId("maven-compiler-plugin");
      MavenPluginFacet pluginFacet = project.getFacet(MavenPluginFacet.class);
      MavenPlugin compiler = pluginFacet.getPlugin(compilerDependency);
      Configuration config = compiler.getConfig();
      if (!config.hasConfigurationElement("proc"))
      {
         ConfigurationElement proc = ConfigurationBuilder.create().createConfigurationElement("proc").setText("none");
         config.addConfigurationElement(proc);
      }
      pluginFacet.updatePlugin(compiler);
   }
View Full Code Here

TOP

Related Classes of org.jboss.forge.maven.plugins.Configuration

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.