diff --git a/nbactions.xml b/nbactions.xml new file mode 100644 index 0000000..6042879 --- /dev/null +++ b/nbactions.xml @@ -0,0 +1,11 @@ + + + + CUSTOM-deploy + deploy + false + + deploy + + + diff --git a/src/main/java/org/bsc/maven/plugin/processor/AbstractAnnotationProcessorMojo.java b/src/main/java/org/bsc/maven/plugin/processor/AbstractAnnotationProcessorMojo.java index 868cfa7..467cba9 100644 --- a/src/main/java/org/bsc/maven/plugin/processor/AbstractAnnotationProcessorMojo.java +++ b/src/main/java/org/bsc/maven/plugin/processor/AbstractAnnotationProcessorMojo.java @@ -23,6 +23,8 @@ import java.io.IOException; import java.io.PrintWriter; import java.nio.charset.Charset; +import java.nio.charset.IllegalCharsetNameException; +import java.nio.charset.UnsupportedCharsetException; import java.util.ArrayList; import java.util.Enumeration; import java.util.List; @@ -177,7 +179,7 @@ interface ArtifactClosure { * * @since 2.2.1 */ - @Parameter(property = "project.build.sourceEncoding", readonly = true, required = true) + @Parameter(property = "project.build.sourceEncoding") private String encoding; /** @@ -474,11 +476,30 @@ public void execute(Artifact artifact) { return; } - final StandardJavaFileManager fileManager = compiler.getStandardFileManager(null, null, Charset.forName(encoding)); + Charset charset = null; ; + + if( encoding != null ) { + try { + charset = Charset.forName(encoding); + } + catch( IllegalCharsetNameException ex1 ) { + getLog().warn( String.format("the given charset name [%s] is illegal!. default is used", encoding )); + charset = null; + } + catch( UnsupportedCharsetException ex2 ) { + getLog().warn( String.format("the given charset name [%s] is unsupported!. default is used", encoding )); + charset = null; + } + } + + final StandardJavaFileManager fileManager = + compiler.getStandardFileManager(null, null, + (charset==null) ? + Charset.defaultCharset() : + charset); if( files!=null && !files.isEmpty() ) { - - + for( JavaFileObject f : fileManager.getJavaFileObjectsFromFiles(files) ) { allSources.add(f);