mirror of https://github.com/apache/maven.git
[MNG-6825] Replace FileUtils with Commons IO (#1067)
* [MNG-6825] Replace FileUtils with Commons IO Co-authored-by: Moderne <team@moderne.io> * Minor fixes and reverts where cases are not handled yet * Drop explicit dependencies on plexus-utils --------- Co-authored-by: Moderne <team@moderne.io>
This commit is contained in:
parent
f071094f34
commit
703f814e34
|
@ -80,10 +80,6 @@ under the License.
|
|||
<groupId>javax.inject</groupId>
|
||||
<artifactId>javax.inject</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>plexus-utils</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.plexus</groupId>
|
||||
<artifactId>plexus-interpolation</artifactId>
|
||||
|
|
|
@ -22,10 +22,10 @@ import java.io.File;
|
|||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.apache.maven.artifact.metadata.ArtifactMetadata;
|
||||
import org.apache.maven.artifact.repository.ArtifactRepository;
|
||||
import org.apache.maven.artifact.repository.DefaultArtifactRepository;
|
||||
import org.codehaus.plexus.util.FileUtils;
|
||||
import org.eclipse.aether.RepositoryException;
|
||||
import org.eclipse.aether.metadata.AbstractMetadata;
|
||||
import org.eclipse.aether.metadata.MergeableMetadata;
|
||||
|
|
|
@ -22,12 +22,12 @@ import javax.inject.Inject;
|
|||
|
||||
import java.io.File;
|
||||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.apache.maven.artifact.AbstractArtifactComponentTestCase;
|
||||
import org.apache.maven.artifact.Artifact;
|
||||
import org.apache.maven.artifact.repository.ArtifactRepository;
|
||||
import org.apache.maven.execution.MavenSession;
|
||||
import org.apache.maven.session.scope.internal.SessionScope;
|
||||
import org.codehaus.plexus.util.FileUtils;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.codehaus.plexus.testing.PlexusExtension.getBasedir;
|
||||
|
@ -60,14 +60,15 @@ public class ArtifactDeployerTest extends AbstractArtifactComponentTestCase {
|
|||
Artifact artifact = createArtifact("artifact", "1.0");
|
||||
|
||||
File file = new File(artifactBasedir, "artifact-1.0.jar");
|
||||
assertEquals("dummy", FileUtils.fileRead(file, "UTF-8").trim());
|
||||
assertEquals("dummy", FileUtils.readFileToString(file, "UTF-8").trim());
|
||||
|
||||
artifactDeployer.deploy(file, artifact, remoteRepository(), localRepository());
|
||||
|
||||
ArtifactRepository remoteRepository = remoteRepository();
|
||||
File deployedFile = new File(remoteRepository.getBasedir(), remoteRepository.pathOf(artifact));
|
||||
assertTrue(deployedFile.exists());
|
||||
assertEquals("dummy", FileUtils.fileRead(deployedFile, "UTF-8").trim());
|
||||
assertEquals(
|
||||
"dummy", FileUtils.readFileToString(deployedFile, "UTF-8").trim());
|
||||
} finally {
|
||||
sessionScope.exit();
|
||||
}
|
||||
|
|
|
@ -123,6 +123,10 @@ under the License.
|
|||
<groupId>com.google.guava</groupId>
|
||||
<artifactId>failureaccess</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-io</groupId>
|
||||
<artifactId>commons-io</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.inject</groupId>
|
||||
<artifactId>javax.inject</artifactId>
|
||||
|
@ -154,11 +158,6 @@ under the License.
|
|||
<artifactId>commons-jxpath</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-io</groupId>
|
||||
<artifactId>commons-io</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mockito</groupId>
|
||||
<artifactId>mockito-core</artifactId>
|
||||
|
|
|
@ -21,12 +21,12 @@ package org.apache.maven.project.artifact;
|
|||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.apache.maven.artifact.Artifact;
|
||||
import org.apache.maven.artifact.metadata.AbstractArtifactMetadata;
|
||||
import org.apache.maven.artifact.metadata.ArtifactMetadata;
|
||||
import org.apache.maven.artifact.repository.ArtifactRepository;
|
||||
import org.apache.maven.artifact.repository.metadata.RepositoryMetadataStoreException;
|
||||
import org.codehaus.plexus.util.FileUtils;
|
||||
|
||||
/**
|
||||
* Attach a POM to an artifact.
|
||||
|
|
|
@ -23,9 +23,9 @@ import javax.inject.Inject;
|
|||
import java.io.File;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.codehaus.plexus.PlexusContainer;
|
||||
import org.codehaus.plexus.testing.PlexusTest;
|
||||
import org.codehaus.plexus.util.FileUtils;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.codehaus.plexus.testing.PlexusExtension.getTestFile;
|
||||
|
@ -40,7 +40,7 @@ public class ArtifactHandlerTest {
|
|||
public void testAptConsistency() throws Exception {
|
||||
File apt = getTestFile("src/site/apt/artifact-handlers.apt");
|
||||
|
||||
List<String> lines = FileUtils.loadFile(apt);
|
||||
List<String> lines = FileUtils.readLines(apt);
|
||||
|
||||
for (String line : lines) {
|
||||
if (line.startsWith("||")) {
|
||||
|
|
|
@ -29,6 +29,7 @@ import java.util.LinkedHashMap;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.apache.maven.api.model.Model;
|
||||
import org.apache.maven.artifact.Artifact;
|
||||
import org.apache.maven.artifact.DefaultArtifact;
|
||||
|
@ -55,7 +56,6 @@ import org.apache.maven.repository.RepositorySystem;
|
|||
import org.apache.maven.settings.Mirror;
|
||||
import org.apache.maven.settings.Proxy;
|
||||
import org.apache.maven.settings.Server;
|
||||
import org.codehaus.plexus.util.FileUtils;
|
||||
import org.codehaus.plexus.util.StringUtils;
|
||||
import org.eclipse.aether.RepositorySystemSession;
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ import java.net.MalformedURLException;
|
|||
import java.net.URL;
|
||||
import java.util.Collection;
|
||||
|
||||
import org.codehaus.plexus.util.FileUtils;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.eclipse.aether.artifact.Artifact;
|
||||
import org.eclipse.aether.metadata.Metadata;
|
||||
import org.eclipse.aether.repository.RemoteRepository;
|
||||
|
|
|
@ -30,6 +30,7 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.apache.maven.api.model.Model;
|
||||
import org.apache.maven.artifact.Artifact;
|
||||
import org.apache.maven.artifact.DefaultArtifact;
|
||||
|
@ -52,7 +53,6 @@ import org.apache.maven.project.artifact.ArtifactWithDependencies;
|
|||
import org.apache.maven.settings.Mirror;
|
||||
import org.apache.maven.settings.Proxy;
|
||||
import org.apache.maven.settings.Server;
|
||||
import org.codehaus.plexus.util.FileUtils;
|
||||
import org.codehaus.plexus.util.StringUtils;
|
||||
import org.eclipse.aether.RepositorySystemSession;
|
||||
|
||||
|
|
|
@ -107,10 +107,6 @@ under the License.
|
|||
<groupId>javax.annotation</groupId>
|
||||
<artifactId>javax.annotation-api</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>plexus-utils</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.plexus</groupId>
|
||||
<artifactId>plexus-classworlds</artifactId>
|
||||
|
|
|
@ -27,7 +27,7 @@ import java.util.Comparator;
|
|||
import java.util.List;
|
||||
|
||||
import org.apache.commons.cli.Option;
|
||||
import org.codehaus.plexus.util.FileUtils;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
|
@ -88,6 +88,6 @@ public class CLIManagerDocumentationTest {
|
|||
@Test
|
||||
public void testOptionsAsHtml() throws IOException {
|
||||
File options = new File("target/test-classes/options.html");
|
||||
FileUtils.fileWrite(options, "UTF-8", getOptionsAsHtml());
|
||||
FileUtils.write(options, getOptionsAsHtml(), "UTF-8");
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue