don't require output encoding in antlr4 mvn plugin

This commit is contained in:
parrt 2016-11-21 11:05:31 -08:00
parent 06285d16d7
commit df89ad6180
1 changed files with 8 additions and 2 deletions

View File

@ -316,8 +316,9 @@ public class Antlr4Mojo extends AbstractMojo {
args.add("-atn");
}
if ( inputEncoding!= null && !inputEncoding.isEmpty()) {
if ( inputEncoding!=null && !inputEncoding.isEmpty()) {
args.add("-encoding");
outputEncoding = inputEncoding;
args.add(inputEncoding);
}
@ -521,7 +522,12 @@ public class Antlr4Mojo extends AbstractMojo {
URI relativePath = project.getBasedir().toURI().relativize(outputFile.toURI());
getLog().debug(" Writing file: " + relativePath);
OutputStream outputStream = buildContext.newFileOutputStream(outputFile);
return new BufferedWriter(new OutputStreamWriter(outputStream, outputEncoding));
if ( outputEncoding!=null && !outputEncoding.isEmpty()) {
return new BufferedWriter(new OutputStreamWriter(outputStream, outputEncoding));
}
else {
return new BufferedWriter(new OutputStreamWriter(outputStream));
}
}
}
}