[hg] main-silver: #191387 remove additionalParameters configurat...

  • From: Milos Kleint < >
  • To: ,
  • Subject: [hg] main-silver: #191387 remove additionalParameters configurat...
  • Date: Fri, 12 Jul 2013 10:37:08 -0700

changeset 1eac5b368bdb in main-silver ((none))
details: http://hg.netbeans.org/main-silver/rev/1eac5b368bdb
description:
        #191387 remove additionalParameters configuration from the pom when 
creating the property, move the content there

diffstat:

 
maven.apisupport/src/org/netbeans/modules/maven/apisupport/NetBeansRunParamsIDEChecker.java
 |  48 ++++++++++
 1 files changed, 48 insertions(+), 0 deletions(-)

diffs (74 lines):

diff --git 
a/maven.apisupport/src/org/netbeans/modules/maven/apisupport/NetBeansRunParamsIDEChecker.java
 
b/maven.apisupport/src/org/netbeans/modules/maven/apisupport/NetBeansRunParamsIDEChecker.java
--- 
a/maven.apisupport/src/org/netbeans/modules/maven/apisupport/NetBeansRunParamsIDEChecker.java
+++ 
b/maven.apisupport/src/org/netbeans/modules/maven/apisupport/NetBeansRunParamsIDEChecker.java
@@ -67,6 +67,11 @@
 import org.openide.util.Exceptions;
 import org.openide.util.NbBundle.Messages;
 import static org.netbeans.modules.maven.apisupport.Bundle.*;
+import org.netbeans.modules.maven.model.pom.Build;
+import org.netbeans.modules.maven.model.pom.Configuration;
+import org.netbeans.modules.maven.model.pom.POMExtensibilityElement;
+import org.netbeans.modules.maven.model.pom.Plugin;
+import org.netbeans.modules.maven.model.pom.PluginManagement;
 
 /**
  * Ensures that {@code netbeans.run.params.ide} will be interpolated into 
{@code netbeans.run.params}.
@@ -123,6 +128,8 @@
             public @Override void performOperation(POMModel model) {
                 POMComponentFactory factory = model.getFactory();
                 Project project = model.getProject();
+                //find and remove value from additionaParameters mojo 
paramerer
+                String val = findAndRemoveAdditionalParameters(model);
                 Properties properties = project.getProperties();
                 if (properties == null) {
                     properties = factory.createProperties();
@@ -138,8 +145,49 @@
                 } else if (!args.contains(ref)) {
                     args += " " + ref;
                 }
+                if (val != null) {
+                    args = args + " " + val;
+                }
                 properties.setProperty(MASTER_PROPERTY, args);
             }
+
+            private String findAndRemoveAdditionalParameters(POMModel model) 
{
+                Project project = model.getProject();
+                Build bld = project.getBuild();
+                if (bld != null) {
+                    Plugin plg = 
bld.findPluginById(MavenNbModuleImpl.GROUPID_MOJO, 
MavenNbModuleImpl.NBM_PLUGIN);
+                    if (plg != null) {
+                        Configuration conf = plg.getConfiguration();
+                        if (conf != null) {
+                            for (POMExtensibilityElement ex : 
conf.getConfigurationElements()) {
+                                if 
("additionalArguments".equals(ex.getQName().getLocalPart())) {
+                                    String s = ex.getElementText();
+                                    conf.removeExtensibilityElement(ex);
+                                    return s;
+                                }
+                            }
+                        }
+                    }
+                    PluginManagement pm = bld.getPluginManagement();
+                    if (pm != null) {
+                        plg = 
pm.findPluginById(MavenNbModuleImpl.GROUPID_MOJO, 
MavenNbModuleImpl.NBM_PLUGIN);
+                        if (plg != null) {
+                            Configuration conf = plg.getConfiguration();
+                            if (conf != null) {
+                                for (POMExtensibilityElement ex : 
conf.getConfigurationElements()) {
+                                    if 
("additionalArguments".equals(ex.getQName().getLocalPart())) {
+                                        String s = ex.getElementText();
+                                        conf.removeExtensibilityElement(ex);
+                                        return s;
+                                    }
+                                }
+                            }
+                        }
+                    }
+                }
+                //we could also check profiles content but that would be a 
bit messy already..
+                return null;
+            }
         }));
     }
 

[hg] main-silver: #191387 remove additionalParameters configurat...

Milos Kleint 07/12/2013

Project Features

About this Project

APIsupport was started in November 2009, is owned by Antonin Nebuzelsky, and has 43 members.
By use of this website, you agree to the NetBeans Policies and Terms of Use (revision 20131025.e7cbc9d). © 2013, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo
 
 
Close
loading
Please Confirm
Close