Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MNG-6825] Replace FileUtils with Commons IO #1067

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions maven-compat/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@
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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@

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;
Expand Down Expand Up @@ -60,14 +60,15 @@ public void testArtifactInstallation() throws Exception {
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();
}
Expand Down
9 changes: 4 additions & 5 deletions maven-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@
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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
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;
Expand All @@ -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("||")) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
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;
Expand All @@ -55,7 +56,6 @@
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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
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;
Expand All @@ -52,7 +53,6 @@
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;

Expand Down
4 changes: 0 additions & 4 deletions maven-embedder/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
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;

/**
Expand Down Expand Up @@ -88,6 +88,6 @@ public String getOptionsAsHtml() {
@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");
}
}