21
21
import java .io .File ;
22
22
import java .io .FileNotFoundException ;
23
23
import java .io .IOException ;
24
- import java .io .Reader ;
25
- import java .io .Writer ;
24
+ import java .io .InputStream ;
25
+ import java .io .OutputStream ;
26
26
import java .nio .file .Files ;
27
27
import java .util .ArrayList ;
28
28
import java .util .List ;
46
46
import org .apache .maven .plugins .annotations .Parameter ;
47
47
import org .apache .maven .project .MavenProject ;
48
48
import org .codehaus .plexus .util .FileUtils ;
49
- import org .codehaus .plexus .util .ReaderFactory ;
50
49
import org .codehaus .plexus .util .StringUtils ;
51
- import org .codehaus .plexus .util .WriterFactory ;
52
50
import org .codehaus .plexus .util .xml .pull .XmlPullParserException ;
53
51
import org .eclipse .aether .RepositorySystem ;
54
52
import org .eclipse .aether .artifact .Artifact ;
@@ -401,8 +399,8 @@ private void processModel(Model model) {
401
399
* @throws MojoExecutionException If the file doesn't exist of cannot be read.
402
400
*/
403
401
private Model readModel (File pomFile ) throws MojoExecutionException {
404
- try (Reader reader = ReaderFactory . newXmlReader (pomFile )) {
405
- return new MavenXpp3Reader ().read (reader );
402
+ try (InputStream inputStream = Files . newInputStream (pomFile . toPath () )) {
403
+ return new MavenXpp3Reader ().read (inputStream );
406
404
} catch (FileNotFoundException e ) {
407
405
throw new MojoExecutionException ("POM not found " + pomFile , e );
408
406
} catch (IOException e ) {
@@ -425,8 +423,8 @@ private File generatePomFile() throws MojoExecutionException {
425
423
File tempFile = Files .createTempFile ("mvndeploy" , ".pom" ).toFile ();
426
424
tempFile .deleteOnExit ();
427
425
428
- try (Writer fw = WriterFactory . newXmlWriter (tempFile )) {
429
- new MavenXpp3Writer ().write (fw , model );
426
+ try (OutputStream outputStream = Files . newOutputStream (tempFile . toPath () )) {
427
+ new MavenXpp3Writer ().write (outputStream , model );
430
428
}
431
429
432
430
return tempFile ;
0 commit comments