mirror of
https://github.com/apache/maven-mvnd.git
synced 2025-09-21 19:35:08 +00:00
Remove plexus-utils and commons-xxx references (#833)
This commit is contained in:
@@ -43,7 +43,6 @@ import java.util.stream.Stream;
|
||||
|
||||
import org.apache.maven.cli.internal.extension.model.CoreExtension;
|
||||
import org.apache.maven.cli.internal.extension.model.io.xpp3.CoreExtensionsXpp3Reader;
|
||||
import org.codehaus.plexus.util.StringUtils;
|
||||
import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
|
||||
import org.mvndaemon.mvnd.common.Environment;
|
||||
import org.mvndaemon.mvnd.common.InterpolationHelper;
|
||||
@@ -440,8 +439,8 @@ public class DaemonParameters {
|
||||
private static List<String> parseExtClasspath(Path userDir) {
|
||||
String extClassPath = System.getProperty(EXT_CLASS_PATH);
|
||||
List<String> jars = new ArrayList<>();
|
||||
if (StringUtils.isNotEmpty(extClassPath)) {
|
||||
for (String jar : StringUtils.split(extClassPath, File.pathSeparator)) {
|
||||
if (extClassPath != null) {
|
||||
for (String jar : extClassPath.split(File.pathSeparator)) {
|
||||
Path path = userDir.resolve(jar).toAbsolutePath();
|
||||
jars.add(path.toString());
|
||||
}
|
||||
|
@@ -93,7 +93,6 @@ import org.codehaus.plexus.PlexusContainer;
|
||||
import org.codehaus.plexus.classworlds.ClassWorld;
|
||||
import org.codehaus.plexus.classworlds.realm.ClassRealm;
|
||||
import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
|
||||
import org.codehaus.plexus.util.StringUtils;
|
||||
import org.eclipse.aether.transfer.TransferListener;
|
||||
import org.mvndaemon.mvnd.cache.invalidating.InvalidatingExtensionRealmCache;
|
||||
import org.mvndaemon.mvnd.cache.invalidating.InvalidatingPluginArtifactsCache;
|
||||
@@ -652,12 +651,10 @@ public class DaemonMavenCli implements DaemonCli {
|
||||
|
||||
List<File> jars = new ArrayList<>();
|
||||
|
||||
if (StringUtils.isNotEmpty(extClassPath)) {
|
||||
for (String jar : StringUtils.split(extClassPath, File.pathSeparator)) {
|
||||
if (extClassPath != null) {
|
||||
for (String jar : extClassPath.split(File.pathSeparator)) {
|
||||
File file = resolveFile(new File(jar), cliRequest.workingDirectory);
|
||||
|
||||
slf4jLogger.debug(" Included {}", file);
|
||||
|
||||
jars.add(file);
|
||||
}
|
||||
}
|
||||
@@ -819,19 +816,11 @@ public class DaemonMavenCli implements DaemonCli {
|
||||
|
||||
private void logSummary(
|
||||
ExceptionSummary summary, Map<String, String> references, String indent, boolean showErrors) {
|
||||
String referenceKey = "";
|
||||
|
||||
if (StringUtils.isNotEmpty(summary.getReference())) {
|
||||
referenceKey = references.get(summary.getReference());
|
||||
if (referenceKey == null) {
|
||||
referenceKey = "[Help " + (references.size() + 1) + "]";
|
||||
references.put(summary.getReference(), referenceKey);
|
||||
}
|
||||
}
|
||||
|
||||
String msg = summary.getMessage();
|
||||
|
||||
if (StringUtils.isNotEmpty(referenceKey)) {
|
||||
if (!summary.getReference().isEmpty()) {
|
||||
String referenceKey =
|
||||
references.computeIfAbsent(summary.getReference(), k -> "[Help " + (references.size() + 1) + "]");
|
||||
if (msg.indexOf('\n') < 0) {
|
||||
msg += " -> " + buffer().strong(referenceKey);
|
||||
} else {
|
||||
|
@@ -49,7 +49,6 @@ import java.nio.file.Paths;
|
||||
import java.util.Properties;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.maven.execution.MavenExecutionRequest;
|
||||
import org.apache.maven.project.MavenProject;
|
||||
import org.slf4j.Logger;
|
||||
@@ -144,10 +143,11 @@ public class DefaultBuildResumptionDataRepository implements BuildResumptionData
|
||||
|
||||
// This method is made package-private for testing purposes
|
||||
void applyResumptionProperties(MavenExecutionRequest request, Properties properties) {
|
||||
if (properties.containsKey(REMAINING_PROJECTS) && StringUtils.isEmpty(request.getResumeFrom())) {
|
||||
if (properties.containsKey(REMAINING_PROJECTS)
|
||||
&& (request.getResumeFrom() == null || request.getResumeFrom().isEmpty())) {
|
||||
String propertyValue = properties.getProperty(REMAINING_PROJECTS);
|
||||
Stream.of(propertyValue.split(PROPERTY_DELIMITER))
|
||||
.filter(StringUtils::isNotEmpty)
|
||||
.filter(s -> s != null && !s.isEmpty())
|
||||
.forEach(request.getSelectedProjects()::add);
|
||||
LOGGER.info("Resuming from {} due to the --resume / -r feature.", propertyValue);
|
||||
}
|
||||
|
@@ -45,7 +45,6 @@ import com.google.inject.AbstractModule;
|
||||
import org.apache.commons.cli.CommandLine;
|
||||
import org.apache.commons.cli.Option;
|
||||
import org.apache.commons.cli.ParseException;
|
||||
import org.apache.commons.lang3.math.NumberUtils;
|
||||
import org.apache.maven.InternalErrorException;
|
||||
import org.apache.maven.Maven;
|
||||
import org.apache.maven.building.FileSource;
|
||||
@@ -88,7 +87,6 @@ import org.codehaus.plexus.PlexusContainer;
|
||||
import org.codehaus.plexus.classworlds.ClassWorld;
|
||||
import org.codehaus.plexus.classworlds.realm.ClassRealm;
|
||||
import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
|
||||
import org.codehaus.plexus.util.StringUtils;
|
||||
import org.eclipse.aether.transfer.TransferListener;
|
||||
import org.mvndaemon.mvnd.cache.invalidating.InvalidatingExtensionRealmCache;
|
||||
import org.mvndaemon.mvnd.cache.invalidating.InvalidatingPluginArtifactsCache;
|
||||
@@ -637,12 +635,10 @@ public class DaemonMavenCli implements DaemonCli {
|
||||
|
||||
List<File> jars = new ArrayList<>();
|
||||
|
||||
if (StringUtils.isNotEmpty(extClassPath)) {
|
||||
for (String jar : StringUtils.split(extClassPath, File.pathSeparator)) {
|
||||
if (extClassPath != null) {
|
||||
for (String jar : extClassPath.split(File.pathSeparator)) {
|
||||
File file = resolveFile(new File(jar), cliRequest.workingDirectory);
|
||||
|
||||
slf4jLogger.debug(" Included {}", file);
|
||||
|
||||
jars.add(file);
|
||||
}
|
||||
}
|
||||
@@ -787,19 +783,11 @@ public class DaemonMavenCli implements DaemonCli {
|
||||
|
||||
private void logSummary(
|
||||
ExceptionSummary summary, Map<String, String> references, String indent, boolean showErrors) {
|
||||
String referenceKey = "";
|
||||
|
||||
if (StringUtils.isNotEmpty(summary.getReference())) {
|
||||
referenceKey = references.get(summary.getReference());
|
||||
if (referenceKey == null) {
|
||||
referenceKey = "[Help " + (references.size() + 1) + "]";
|
||||
references.put(summary.getReference(), referenceKey);
|
||||
}
|
||||
}
|
||||
|
||||
String msg = summary.getMessage();
|
||||
|
||||
if (StringUtils.isNotEmpty(referenceKey)) {
|
||||
if (!summary.getReference().isEmpty()) {
|
||||
String referenceKey =
|
||||
references.computeIfAbsent(summary.getReference(), k -> "[Help " + (references.size() + 1) + "]");
|
||||
if (msg.indexOf('\n') < 0) {
|
||||
msg += " -> " + buffer().strong(referenceKey);
|
||||
} else {
|
||||
@@ -1241,14 +1229,9 @@ public class DaemonMavenCli implements DaemonCli {
|
||||
|
||||
int calculateDegreeOfConcurrency(String threadConfiguration) {
|
||||
if (threadConfiguration.endsWith("C")) {
|
||||
threadConfiguration = threadConfiguration.substring(0, threadConfiguration.length() - 1);
|
||||
|
||||
if (!NumberUtils.isParsable(threadConfiguration)) {
|
||||
throw new IllegalArgumentException("Invalid threads core multiplier value: '" + threadConfiguration
|
||||
+ "C'. Supported are int and float values ending with C.");
|
||||
}
|
||||
|
||||
float coreMultiplier = Float.parseFloat(threadConfiguration);
|
||||
try {
|
||||
String str = threadConfiguration.substring(0, threadConfiguration.length() - 1);
|
||||
float coreMultiplier = Float.parseFloat(str);
|
||||
|
||||
if (coreMultiplier <= 0.0f) {
|
||||
throw new IllegalArgumentException("Invalid threads core multiplier value: '" + threadConfiguration
|
||||
@@ -1258,12 +1241,11 @@ public class DaemonMavenCli implements DaemonCli {
|
||||
int procs = Runtime.getRuntime().availableProcessors();
|
||||
int threads = (int) (coreMultiplier * procs);
|
||||
return threads == 0 ? 1 : threads;
|
||||
} else {
|
||||
if (!NumberUtils.isParsable(threadConfiguration)) {
|
||||
throw new IllegalArgumentException(
|
||||
"Invalid threads value: '" + threadConfiguration + "'. Supported are int values.");
|
||||
} catch (NumberFormatException e) {
|
||||
throw new IllegalArgumentException("Invalid threads core multiplier value: '" + threadConfiguration
|
||||
+ "C'. Supported are int and float values ending with C.");
|
||||
}
|
||||
|
||||
} else {
|
||||
try {
|
||||
int threads = Integer.parseInt(threadConfiguration);
|
||||
|
||||
|
@@ -31,7 +31,6 @@ import org.codehaus.plexus.components.interactivity.InputHandler;
|
||||
import org.codehaus.plexus.components.interactivity.OutputHandler;
|
||||
import org.codehaus.plexus.components.interactivity.Prompter;
|
||||
import org.codehaus.plexus.components.interactivity.PrompterException;
|
||||
import org.codehaus.plexus.util.StringUtils;
|
||||
import org.eclipse.sisu.Priority;
|
||||
import org.eclipse.sisu.Typed;
|
||||
import org.mvndaemon.mvnd.common.Message;
|
||||
@@ -115,7 +114,7 @@ public class DaemonPrompter extends AbstractInputHandler implements Prompter, In
|
||||
} catch (IOException e) {
|
||||
throw new PrompterException("Failed to prompt user", e);
|
||||
}
|
||||
if (StringUtils.isEmpty(line)) {
|
||||
if (line == null || line.isEmpty()) {
|
||||
line = defaultReply;
|
||||
}
|
||||
if (line != null && (possibleValues != null && !possibleValues.contains(line))) {
|
||||
|
@@ -36,7 +36,6 @@ import org.apache.maven.eventspy.EventSpy;
|
||||
import org.apache.maven.execution.ExecutionEvent;
|
||||
import org.apache.maven.execution.MavenSession;
|
||||
import org.apache.maven.plugin.MojoExecution;
|
||||
import org.codehaus.plexus.util.StringUtils;
|
||||
import org.eclipse.sisu.Typed;
|
||||
import org.mvndaemon.mvnd.common.Environment;
|
||||
import org.slf4j.Logger;
|
||||
@@ -196,9 +195,17 @@ public class BuildTimeEventSpy extends AbstractEventSpy {
|
||||
|
||||
public String name() {
|
||||
String name = mojo.getKey();
|
||||
String truncatedName =
|
||||
name.length() >= MAX_NAME_LENGTH ? StringUtils.substring(name, 0, MAX_NAME_LENGTH) : name + " ";
|
||||
return StringUtils.rightPad(truncatedName, MAX_NAME_LENGTH, ".");
|
||||
if (name.length() < MAX_NAME_LENGTH) {
|
||||
StringBuilder sb = new StringBuilder(MAX_NAME_LENGTH);
|
||||
sb.append(name);
|
||||
sb.append(' ');
|
||||
while (sb.length() < MAX_NAME_LENGTH) {
|
||||
sb.append('.');
|
||||
}
|
||||
return sb.toString();
|
||||
} else {
|
||||
return name.substring(0, MAX_NAME_LENGTH);
|
||||
}
|
||||
}
|
||||
|
||||
public long duration() {
|
||||
|
Reference in New Issue
Block a user