[MNG-8283] Minor: method rename

This commit is contained in:
Tamas Cservenak 2024-10-04 18:05:13 +02:00
parent 60ae468a2e
commit 1817aaeaad
3 changed files with 6 additions and 12 deletions
maven-cli/src/main/java/org/apache/maven/cling/invoker

View File

@ -156,7 +156,7 @@ public abstract class LookupInvoker<
try { try {
validate(context); validate(context);
prepare(context); prepare(context);
logging(context); configureLogging(context);
activateLogging(context); activateLogging(context);
if (invokerRequest.options().help().isPresent()) { if (invokerRequest.options().help().isPresent()) {
@ -208,7 +208,7 @@ public abstract class LookupInvoker<
protected void prepare(C context) throws Exception {} protected void prepare(C context) throws Exception {}
protected void logging(C context) throws Exception { protected void configureLogging(C context) throws Exception {
R invokerRequest = context.invokerRequest; R invokerRequest = context.invokerRequest;
// LOG COLOR // LOG COLOR
Options mavenOptions = invokerRequest.options(); Options mavenOptions = invokerRequest.options();

View File

@ -23,6 +23,7 @@ import java.nio.file.Files;
import java.nio.file.Path; import java.nio.file.Path;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.HashMap;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -39,7 +40,6 @@ import org.apache.maven.api.cli.mvn.MavenOptions;
import org.apache.maven.building.FileSource; import org.apache.maven.building.FileSource;
import org.apache.maven.building.Problem; import org.apache.maven.building.Problem;
import org.apache.maven.cli.CLIReportingUtils; import org.apache.maven.cli.CLIReportingUtils;
import org.apache.maven.cli.event.DefaultEventSpyContext;
import org.apache.maven.cli.event.ExecutionEventLogger; import org.apache.maven.cli.event.ExecutionEventLogger;
import org.apache.maven.cling.invoker.LookupInvoker; import org.apache.maven.cling.invoker.LookupInvoker;
import org.apache.maven.cling.invoker.ProtoLookup; import org.apache.maven.cling.invoker.ProtoLookup;
@ -135,14 +135,13 @@ public abstract class DefaultMavenInvoker<
@Override @Override
protected void init(C context) throws Exception { protected void init(C context) throws Exception {
MavenInvokerRequest<O> invokerRequest = context.invokerRequest; MavenInvokerRequest<O> invokerRequest = context.invokerRequest;
DefaultEventSpyContext eventSpyContext = new DefaultEventSpyContext(); Map<String, Object> data = new HashMap<>();
Map<String, Object> data = eventSpyContext.getData();
data.put("plexus", context.lookup.lookup(PlexusContainer.class)); data.put("plexus", context.lookup.lookup(PlexusContainer.class));
data.put("workingDirectory", invokerRequest.cwd().toString()); data.put("workingDirectory", invokerRequest.cwd().toString());
data.put("systemProperties", toProperties(invokerRequest.systemProperties())); data.put("systemProperties", toProperties(invokerRequest.systemProperties()));
data.put("userProperties", toProperties(invokerRequest.userProperties())); data.put("userProperties", toProperties(invokerRequest.userProperties()));
data.put("versionProperties", CLIReportingUtils.getBuildProperties()); data.put("versionProperties", CLIReportingUtils.getBuildProperties());
context.eventSpyDispatcher.init(eventSpyContext); context.eventSpyDispatcher.init(() -> data);
} }
@Override @Override
@ -443,11 +442,6 @@ public abstract class DefaultMavenInvoker<
protected int doExecute(C context) throws Exception { protected int doExecute(C context) throws Exception {
MavenExecutionRequest request = context.mavenExecutionRequest; MavenExecutionRequest request = context.mavenExecutionRequest;
// why? No way to disable caching?
if (context.mavenExecutionRequest.getRepositoryCache() == null) {
context.mavenExecutionRequest.setRepositoryCache(new DefaultRepositoryCache());
}
context.eventSpyDispatcher.onEvent(request); context.eventSpyDispatcher.onEvent(request);
MavenExecutionResult result; MavenExecutionResult result;

View File

@ -114,7 +114,7 @@ public class DefaultResidentMavenInvoker
try { try {
validate(master); validate(master);
prepare(master); prepare(master);
logging(master); configureLogging(master);
container(master); container(master);
lookup(master); lookup(master);
return master; return master;