Created
February 3, 2017 19:05
-
-
Save dkirrane/8683d2486d7b029b07926d5b5bcd147e to your computer and use it in GitHub Desktop.
NbMavenProjectCache.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/maven/src/org/netbeans/modules/maven/modelcache/MavenProjectCache.java b/maven/src/org/netbeans/modules/maven/modelcache/MavenProjectCache.java | |
index 97d902295c1..b05bb281c9d 100644 | |
--- a/maven/src/org/netbeans/modules/maven/modelcache/MavenProjectCache.java | |
+++ b/maven/src/org/netbeans/modules/maven/modelcache/MavenProjectCache.java | |
@@ -46,6 +46,7 @@ import java.lang.ref.WeakReference; | |
import java.util.ArrayList; | |
import java.util.Arrays; | |
import java.util.Collection; | |
+import java.util.Collections; | |
import java.util.HashSet; | |
import java.util.List; | |
import java.util.Map; | |
@@ -60,6 +61,9 @@ import org.apache.maven.execution.DefaultMavenExecutionResult; | |
import org.apache.maven.execution.MavenExecutionRequest; | |
import org.apache.maven.execution.MavenExecutionResult; | |
import org.apache.maven.project.MavenProject; | |
+import org.apache.maven.execution.MavenSession; | |
+import org.apache.maven.plugin.LegacySupport; | |
+import org.apache.maven.MavenExecutionException; | |
import org.codehaus.plexus.component.repository.exception.ComponentLookupException; | |
import org.netbeans.api.annotations.common.NonNull; | |
import org.netbeans.modules.maven.M2AuxilaryConfigImpl; | |
@@ -69,6 +73,7 @@ import org.netbeans.modules.maven.embedder.MavenEmbedder; | |
import org.netbeans.spi.project.AuxiliaryConfiguration; | |
import org.openide.filesystems.FileObject; | |
import org.openide.filesystems.FileUtil; | |
+import org.openide.util.Exceptions; | |
import org.openide.util.Mutex; | |
import org.openide.util.Mutex.Action; | |
import org.openide.util.NbBundle; | |
@@ -199,24 +204,24 @@ public final class MavenProjectCache { | |
//boolean execute = EnableParticipantsBuildAction.isEnabled(aux); | |
List<AbstractMavenLifecycleParticipant> lookup = projectEmbedder.getPlexus().lookupList(AbstractMavenLifecycleParticipant.class); | |
if (lookup.size() > 0) { //just in case.. | |
-// if (execute) { | |
-// LOG.info("Executing External Build Participants..."); | |
-// MavenSession session = new MavenSession( projectEmbedder.getPlexus(), newproject.getProjectBuildingRequest().getRepositorySession(), req, res ); | |
-// session.setCurrentProject(newproject); | |
-// session.setProjects(Collections.singletonList(newproject)); | |
-// projectEmbedder.setUpLegacySupport(); | |
-// projectEmbedder.getPlexus().lookup(LegacySupport.class).setSession(session); | |
-// | |
-// for (AbstractMavenLifecycleParticipant part : lookup) { | |
-// try { | |
-// Thread.currentThread().setContextClassLoader( part.getClass().getClassLoader() ); | |
-// part.afterSessionStart(session); | |
-// part.afterProjectsRead(session); | |
-// } catch (MavenExecutionException ex) { | |
-// Exceptions.printStackTrace(ex); | |
-// } | |
-// } | |
-// } else { | |
+ if (true) { | |
+ LOG.info("Executing External Build Participants..."); | |
+ MavenSession session = new MavenSession( projectEmbedder.getPlexus(), newproject.getProjectBuildingRequest().getRepositorySession(), req, res ); | |
+ session.setCurrentProject(newproject); | |
+ session.setProjects(Collections.singletonList(newproject)); | |
+ projectEmbedder.setUpLegacySupport(); | |
+ projectEmbedder.getPlexus().lookup(LegacySupport.class).setSession(session); | |
+ | |
+ for (AbstractMavenLifecycleParticipant part : lookup) { | |
+ try { | |
+ Thread.currentThread().setContextClassLoader( part.getClass().getClassLoader() ); | |
+ part.afterSessionStart(session); | |
+ part.afterProjectsRead(session); | |
+ } catch (MavenExecutionException ex) { | |
+ Exceptions.printStackTrace(ex); | |
+ } | |
+ } | |
+ } else { | |
List<String> parts = new ArrayList<String>(); | |
for (AbstractMavenLifecycleParticipant part : lookup) { | |
String name = part.getClass().getName(); | |
@@ -229,7 +234,7 @@ public final class MavenProjectCache { | |
if (parts.size() > 0) { | |
newproject.setContextValue(CONTEXT_PARTICIPANTS, parts); | |
} | |
-// } | |
+ } | |
} | |
} catch (ComponentLookupException e) { | |
// this is just silly, lookupList should return an empty list! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment