diff --git a/src/main/java/org/apache/maven/plugins/help/AbstractEffectiveMojo.java b/src/main/java/org/apache/maven/plugins/help/AbstractEffectiveMojo.java
index fab3e6b..ff4e29e 100644
--- a/src/main/java/org/apache/maven/plugins/help/AbstractEffectiveMojo.java
+++ b/src/main/java/org/apache/maven/plugins/help/AbstractEffectiveMojo.java
@@ -25,6 +25,7 @@
import java.io.StringReader;
import java.io.StringWriter;
import java.io.Writer;
+import java.nio.file.Files;
import java.util.ArrayList;
import java.util.Collections;
import java.util.LinkedHashSet;
@@ -32,7 +33,6 @@
import java.util.Properties;
import java.util.Set;
-import org.codehaus.plexus.util.WriterFactory;
import org.codehaus.plexus.util.xml.XMLWriter;
import org.codehaus.plexus.util.xml.XmlWriterUtil;
import org.jdom2.Document;
@@ -49,7 +49,7 @@
*/
public abstract class AbstractEffectiveMojo extends AbstractHelpMojo {
/**
- * Utility method to write an XML content in a given file.
+ * Utility method to write an XML content to a given file.
*
* @param output is the wanted output file.
* @param content contains the XML content to be written to the file.
@@ -62,7 +62,7 @@ protected static void writeXmlFile(File output, String content) throws IOExcepti
}
output.getParentFile().mkdirs();
- try (Writer out = WriterFactory.newXmlWriter(output)) {
+ try (Writer out = Files.newBufferedWriter(output.toPath())) {
out.write(content);
}
}
diff --git a/src/main/java/org/apache/maven/plugins/help/AbstractHelpMojo.java b/src/main/java/org/apache/maven/plugins/help/AbstractHelpMojo.java
index 0439b83..b0135dd 100644
--- a/src/main/java/org/apache/maven/plugins/help/AbstractHelpMojo.java
+++ b/src/main/java/org/apache/maven/plugins/help/AbstractHelpMojo.java
@@ -21,6 +21,7 @@
import java.io.File;
import java.io.IOException;
import java.io.Writer;
+import java.nio.file.Files;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.execution.MavenSession;
@@ -33,7 +34,6 @@
import org.apache.maven.project.MavenProject;
import org.apache.maven.project.ProjectBuilder;
import org.apache.maven.project.ProjectBuildingRequest;
-import org.codehaus.plexus.util.WriterFactory;
import org.eclipse.aether.RepositoryException;
import org.eclipse.aether.RepositorySystem;
import org.eclipse.aether.RepositorySystemSession;
@@ -81,7 +81,8 @@ public abstract class AbstractHelpMojo extends AbstractMojo {
protected MavenSession session;
/**
- * Optional parameter to write the output of this help in a given file, instead of writing to the console.
+ * Optional parameter to write the output of this help to a given file using UTF-8 encoding,
+ * instead of writing to the console.
*
* Note: Could be a relative path.
*/
@@ -89,7 +90,7 @@ public abstract class AbstractHelpMojo extends AbstractMojo {
protected File output;
/**
- * Utility method to write a content in a given file.
+ * Utility method to write a content to a given file.
*
* @param output is the wanted output file.
* @param content contains the content to be written to the file.
@@ -101,7 +102,7 @@ protected static void writeFile(File output, StringBuilder content) throws IOExc
}
/**
- * Utility method to write a content in a given file.
+ * Utility method to write a content to a given file.
*
* @param output is the wanted output file.
* @param content contains the content to be written to the file.
@@ -113,7 +114,7 @@ protected static void writeFile(File output, String content) throws IOException
}
output.getParentFile().mkdirs();
- try (Writer out = WriterFactory.newPlatformWriter(output)) {
+ try (Writer out = Files.newBufferedWriter(output.toPath())) {
out.write(content);
}
}
diff --git a/src/main/java/org/apache/maven/plugins/help/DescribeMojo.java b/src/main/java/org/apache/maven/plugins/help/DescribeMojo.java
index 7cf0ec8..19a8118 100644
--- a/src/main/java/org/apache/maven/plugins/help/DescribeMojo.java
+++ b/src/main/java/org/apache/maven/plugins/help/DescribeMojo.java
@@ -240,7 +240,7 @@ public void execute() throws MojoExecutionException, MojoFailureException {
// ----------------------------------------------------------------------
/**
- * Method to write the Mojo description into the output file
+ * Method to write the Mojo description to the output file
*
* @param descriptionBuffer contains the description to be written to the file
* @throws MojoExecutionException if any