You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@netbeans.apache.org by rt...@apache.org on 2019/03/25 22:40:43 UTC
[incubator-netbeans] branch master updated: maven project compile
args not passed to editor javac (#1173)
This is an automated email from the ASF dual-hosted git repository.
rtaneja pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-netbeans.git
The following commit(s) were added to refs/heads/master by this push:
new 6152dae maven project compile args not passed to editor javac (#1173)
6152dae is described below
commit 6152daeea6051da27da91fe2c97fd396180bfa4f
Author: Reema Taneja <32...@users.noreply.github.com>
AuthorDate: Tue Mar 26 04:10:36 2019 +0530
maven project compile args not passed to editor javac (#1173)
* maven project compile args not passed to editor javac
* Removed check for -parameters
* check for empty args
---
.../maven/queries/PomCompilerOptionsQueryImpl.java | 7 +++++--
.../modules/maven/api/PluginPropertyUtilsTest.java | 17 +++++++++++++++++
2 files changed, 22 insertions(+), 2 deletions(-)
diff --git a/java/maven/src/org/netbeans/modules/maven/queries/PomCompilerOptionsQueryImpl.java b/java/maven/src/org/netbeans/modules/maven/queries/PomCompilerOptionsQueryImpl.java
index 3f4ae7b..bb3d228 100644
--- a/java/maven/src/org/netbeans/modules/maven/queries/PomCompilerOptionsQueryImpl.java
+++ b/java/maven/src/org/netbeans/modules/maven/queries/PomCompilerOptionsQueryImpl.java
@@ -20,6 +20,7 @@ package org.netbeans.modules.maven.queries;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
+import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
@@ -104,11 +105,13 @@ public final class PomCompilerOptionsQueryImpl implements CompilerOptionsQueryIm
private List<String> createArguments() {
String[] compilerArgs = PluginPropertyUtils.getPluginPropertyList(proj, Constants.GROUP_APACHE_PLUGINS, Constants.PLUGIN_COMPILER, "compilerArgs", "arg", null); // NOI18N
if (compilerArgs != null) {
+ List<String> args = new ArrayList();
for (String compilerArg : compilerArgs) {
- if(compilerArg != null && ARG_PARAMETERS.equals(compilerArg.trim())) {
- return Arrays.asList(ARG_PARAMETERS);
+ if ((compilerArg != null) && (!compilerArg.isEmpty())) {
+ args.add(compilerArg);
}
}
+ return args;
}
return EMPTY;
}
diff --git a/java/maven/test/unit/src/org/netbeans/modules/maven/api/PluginPropertyUtilsTest.java b/java/maven/test/unit/src/org/netbeans/modules/maven/api/PluginPropertyUtilsTest.java
index 30576cc..abebe8f 100644
--- a/java/maven/test/unit/src/org/netbeans/modules/maven/api/PluginPropertyUtilsTest.java
+++ b/java/maven/test/unit/src/org/netbeans/modules/maven/api/PluginPropertyUtilsTest.java
@@ -120,5 +120,22 @@ public class PluginPropertyUtilsTest extends NbTestCase {
"</project>");
assertEquals("[one, two]", Arrays.toString(PluginPropertyUtils.getReportPluginPropertyList(ProjectManager.getDefault().findProject(d), "g", "r", "things", "thing", null)));
}
+ public void testGetCompilerArgs() throws Exception {
+ TestFileUtils.writeFile(d, "pom.xml",
+ "<project>"
+ + "<modelVersion>4.0.0</modelVersion>"
+ + "<groupId>g</groupId>"
+ + "<artifactId>a</artifactId>"
+ + "<version>0</version>"
+ + "<build>"
+ + "<plugins><plugin>"
+ + "<groupId>org.apache.maven.plugins</groupId>"
+ + "<artifactId>maven-compiler-plugin</artifactId>"
+ + "<version>3.8.0</version>"
+ + "<configuration><compilerArgs><arg>--enable-preview</arg></compilerArgs>"
+ + "</configuration>"
+ + "</plugin></plugins></build></project>");
+ assertEquals("[--enable-preview]", Arrays.toString(PluginPropertyUtils.getPluginPropertyList(ProjectManager.getDefault().findProject(d), "org.apache.maven.plugins", "maven-compiler-plugin", "compilerArgs", "arg", null)));
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@netbeans.apache.org
For additional commands, e-mail: commits-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists