This is an automated email from the ASF dual-hosted git repository.

geertjan 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 331ac2a  Fix maven output window links for newer versions of Maven 
(#541)
331ac2a is described below

commit 331ac2aeb6e51d5338503f0847078f316964c9dd
Author: Tim Boudreau <niftin...@gmail.com>
AuthorDate: Fri May 11 14:26:27 2018 -0400

    Fix maven output window links for newer versions of Maven (#541)
    
    * Fixes broken output links with newer versions of Maven; was applied to 
the netbeans.org repo after the snapshot for Apache donation was made
    
    * Bump spec version
---
 maven/manifest.mf                                   |  2 +-
 .../maven/output/TestOutputListenerProvider.java    | 21 ++++++++++++++++++++-
 2 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/maven/manifest.mf b/maven/manifest.mf
index d54d271..20fce0d 100644
--- a/maven/manifest.mf
+++ b/maven/manifest.mf
@@ -1,6 +1,6 @@
 Manifest-Version: 1.0
 OpenIDE-Module: org.netbeans.modules.maven/2
-OpenIDE-Module-Specification-Version: 2.127
+OpenIDE-Module-Specification-Version: 2.128
 OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/maven/Bundle.properties
 OpenIDE-Module-Layer: org/netbeans/modules/maven/layer.xml
 AutoUpdate-Show-In-Client: false
diff --git 
a/maven/src/org/netbeans/modules/maven/output/TestOutputListenerProvider.java 
b/maven/src/org/netbeans/modules/maven/output/TestOutputListenerProvider.java
index d7d520c..cb586c2 100644
--- 
a/maven/src/org/netbeans/modules/maven/output/TestOutputListenerProvider.java
+++ 
b/maven/src/org/netbeans/modules/maven/output/TestOutputListenerProvider.java
@@ -27,6 +27,7 @@ import java.util.logging.Level;
 import java.util.logging.Logger;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
+import 
org.codehaus.plexus.component.configurator.expression.ExpressionEvaluationException;
 import org.netbeans.api.java.classpath.ClassPath;
 import org.netbeans.api.project.FileOwnerQuery;
 import org.netbeans.api.project.Project;
@@ -42,6 +43,7 @@ import org.openide.ErrorManager;
 import org.openide.awt.StatusDisplayer;
 import org.openide.filesystems.FileObject;
 import org.openide.filesystems.FileUtil;
+import org.openide.util.Exceptions;
 import org.openide.util.Lookup;
 import org.openide.util.NbBundle.Messages;
 import org.openide.util.RequestProcessor;
@@ -68,6 +70,7 @@ public class TestOutputListenerProvider implements 
OutputProcessor {
     private final Pattern outDirPattern;
     private final Pattern outDirPattern2;
     private final Pattern runningPattern;
+    private final Pattern runningPattern2;
     
     private static final Logger LOG = 
Logger.getLogger(TestOutputListenerProvider.class.getName());
 
@@ -84,12 +87,13 @@ public class TestOutputListenerProvider implements 
OutputProcessor {
         runningPattern = Pattern.compile("(?:\\[surefire\\] )?Running (.*)", 
Pattern.DOTALL); //NOI18N
         outDirPattern = Pattern.compile(".*(?:Surefire)?(?:Failsafe)? report 
directory\\: (.*)", Pattern.DOTALL); //NOI18N
         outDirPattern2 = Pattern.compile(".*Setting reports dir\\: (.*)", 
Pattern.DOTALL); //NOI18N
+        runningPattern2 = 
Pattern.compile("^---\\smaven-surefire-plugin:\\d+\\.\\d+:test\\s.*$", 
Pattern.DOTALL);
     }
     
     public String[] getWatchedGoals() {
         return TESTGOALS;
     }
-    
+
     @Override
     public void processLine(String line, OutputVisitor visitor) {
         if (delayedLine != null) {
@@ -117,6 +121,21 @@ public class TestOutputListenerProvider implements 
OutputProcessor {
             runningTestClass = match.group(1);
             return;
         }
+        match = runningPattern2.matcher(line);
+        if (match.matches()) {
+            try {
+                Object defaultValue = 
PluginPropertyUtils.createEvaluator(visitor.getContext().getCurrentProject())
+                        
.evaluate("${project.build.directory}/surefire-reports");
+                if (defaultValue instanceof String) {
+                    outputDir = (String) defaultValue;
+                    visitor.setOutputListener(new 
TestOutputListener(runningTestClass, outputDir), true);
+                }
+                return;
+            } catch (ExpressionEvaluationException ex) {
+                Exceptions.printStackTrace(ex);
+            }
+
+        }
         match = failSeparatePattern.matcher(line);
         if (match.matches()) {
             visitor.setOutputListener(new TestOutputListener(runningTestClass, 
outputDir), true);

-- 
To stop receiving notification emails like this one, please contact
geert...@apache.org.

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@netbeans.apache.org
For additional commands, e-mail: commits-h...@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to