Remove commons-io dependency

This commit is contained in:
Guillaume Nodet 2024-06-11 09:44:24 +02:00
parent 75a234c0f6
commit e9ece0c9c9
6 changed files with 15 additions and 29 deletions

View File

@ -179,11 +179,6 @@ under the License.
<version>${mockitoVersion}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>

View File

@ -28,7 +28,6 @@ import java.util.List;
import java.util.Properties;
import java.util.concurrent.atomic.AtomicInteger;
import org.apache.commons.io.FileUtils;
import org.apache.maven.AbstractCoreMavenComponentTestCase;
import org.apache.maven.execution.MavenSession;
import org.apache.maven.model.Dependency;
@ -38,6 +37,7 @@ import org.apache.maven.model.building.FileModelSource;
import org.apache.maven.model.building.ModelBuildingRequest;
import org.apache.maven.model.building.ModelProblem;
import org.apache.maven.model.building.ModelSource;
import org.codehaus.plexus.util.FileUtils;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.io.TempDir;
@ -169,7 +169,8 @@ class ProjectBuilderTest extends AbstractCoreMavenComponentTestCase {
// TODO a similar test should be created to test the dependency management (basically all usages
// of DefaultModelBuilder.getCache() are affected by MNG-6530
FileUtils.copyDirectory(new File("src/test/resources/projects/grandchild-check"), tempDir.toFile());
FileUtils.copyDirectoryStructure(new File("src/test/resources/projects/grandchild-check"), tempDir.toFile());
MavenSession mavenSession = createMavenSession(null);
ProjectBuildingRequest configuration = new DefaultProjectBuildingRequest();
configuration.setRepositorySession(mavenSession.getRepositorySession());

View File

@ -167,11 +167,6 @@ under the License.
<artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>

View File

@ -18,15 +18,17 @@
*/
package org.apache.maven.cli;
import java.io.File;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Comparator;
import java.util.List;
import org.apache.commons.cli.Option;
import org.apache.commons.io.FileUtils;
import org.junit.jupiter.api.Test;
import static java.util.Objects.nonNull;
@ -111,7 +113,7 @@ class CLIManagerDocumentationTest {
@Test
void testOptionsAsHtml() throws IOException {
File options = new File("target/test-classes/options.html");
FileUtils.write(options, getOptionsAsHtml(), "UTF-8");
Path options = Paths.get("target/test-classes/options.html");
Files.writeString(options, getOptionsAsHtml(), StandardCharsets.UTF_8);
}
}

View File

@ -19,9 +19,8 @@
package org.apache.maven.cli.event;
import java.io.File;
import java.util.List;
import com.google.common.collect.ImmutableList;
import org.apache.commons.io.FilenameUtils;
import org.apache.maven.execution.ExecutionEvent;
import org.apache.maven.execution.MavenSession;
import org.apache.maven.jline.JLineMessageBuilderFactory;
@ -203,8 +202,8 @@ class ExecutionEventLoggerTest {
MavenProject project3 = generateMavenProject("Apache Maven Embedder 3");
MavenSession session = mock(MavenSession.class);
when(session.getProjects()).thenReturn(ImmutableList.of(project1, project2, project3));
when(session.getAllProjects()).thenReturn(ImmutableList.of(project1, project2, project3));
when(session.getProjects()).thenReturn(List.of(project1, project2, project3));
when(session.getAllProjects()).thenReturn(List.of(project1, project2, project3));
ExecutionEvent sessionStartedEvent = mock(ExecutionEvent.class);
when(sessionStartedEvent.getSession()).thenReturn(session);
@ -236,8 +235,8 @@ class ExecutionEventLoggerTest {
MavenProject project3 = generateMavenProject("Apache Maven Embedder 3");
MavenSession session = mock(MavenSession.class);
when(session.getProjects()).thenReturn(ImmutableList.of(project2, project3));
when(session.getAllProjects()).thenReturn(ImmutableList.of(project1, project2, project3));
when(session.getProjects()).thenReturn(List.of(project2, project3));
when(session.getAllProjects()).thenReturn(List.of(project1, project2, project3));
ExecutionEvent sessionStartedEvent = mock(ExecutionEvent.class);
when(sessionStartedEvent.getSession()).thenReturn(session);
@ -267,6 +266,6 @@ class ExecutionEventLoggerTest {
}
private static String adaptDirSeparator(String path) {
return FilenameUtils.separatorsToSystem(path);
return path.replace('/', File.separatorChar).replace('\\', File.separatorChar);
}
}

View File

@ -166,7 +166,6 @@ under the License.
<cipherVersion>2.0</cipherVersion>
<classWorldsVersion>2.8.0</classWorldsVersion>
<commonsCliVersion>1.8.0</commonsCliVersion>
<commonsIoVersion>2.11.0</commonsIoVersion>
<guiceVersion>6.0.0</guiceVersion>
<guavaVersion>33.2.0-jre</guavaVersion>
<guavafailureaccessVersion>1.0.1</guavafailureaccessVersion>
@ -552,11 +551,6 @@ under the License.
<artifactId>commons-cli</artifactId>
<version>${commonsCliVersion}</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>${commonsIoVersion}</version>
</dependency>
<dependency>
<groupId>commons-jxpath</groupId>
<artifactId>commons-jxpath</artifactId>