Skip to content

Commit

Permalink
Run dependency plugin for project
Browse files Browse the repository at this point in the history
  • Loading branch information
ericglau committed Jul 19, 2021
1 parent ccd6ea8 commit 88751dc
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@
import java.io.FileReader;
import java.io.IOException;
import java.io.PrintWriter;
import java.nio.file.Files;
import java.nio.file.Path;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.EnumSet;
Expand All @@ -50,6 +48,7 @@
import javax.xml.transform.TransformerException;

import org.apache.maven.artifact.Artifact;
import org.apache.maven.execution.MavenSession;
import org.apache.maven.execution.ProjectDependencyGraph;
import org.apache.maven.model.Plugin;
import org.apache.maven.model.PluginManagement;
Expand Down Expand Up @@ -965,7 +964,7 @@ private void installEmptyEAR(MavenProject earProject) throws MojoExecutionExcept
}

protected void purgeLocalRepositoryModule(MavenProject project) throws MojoExecutionException {
Plugin plugin = getPlugin("org.apache.maven.plugins", "maven-dependency-plugin");
Plugin plugin = getPluginForProject("org.apache.maven.plugins", "maven-dependency-plugin", project);
String goal = "purge-local-repository";
Xpp3Dom config = ExecuteMojoUtil.getPluginGoalConfig(plugin, goal, log);
config = Xpp3Dom.mergeXpp3Dom(configuration(
Expand All @@ -975,7 +974,9 @@ protected void purgeLocalRepositoryModule(MavenProject project) throws MojoExecu
), config);
log.info("Running maven-dependency-plugin:" + goal);
log.debug("configuration:\n" + config);
executeMojo(plugin, goal(goal), config, executionEnvironment(project, session, pluginManager));
MavenSession projectSession = session.clone();
projectSession.setCurrentProject(project);
executeMojo(plugin, goal(goal), config, executionEnvironment(project, projectSession, pluginManager));
}

/**
Expand Down

0 comments on commit 88751dc

Please sign in to comment.