From fed8bfecc523ec9ae70838f7e1b16c8374cb78ec Mon Sep 17 00:00:00 2001 From: Christian Beikov Date: Thu, 7 Sep 2017 12:06:58 +0200 Subject: [PATCH 1/2] Pass through additional compiler arguments This will allow to pass arguments like "--add-modules=java.se.ee" as `compilerArguments` --- .../AnnotationProcessorCompiler.java | 36 ++++++++++--------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/src/main/java/org/bsc/maven/plugin/processor/AnnotationProcessorCompiler.java b/src/main/java/org/bsc/maven/plugin/processor/AnnotationProcessorCompiler.java index e84be9e..2890a64 100644 --- a/src/main/java/org/bsc/maven/plugin/processor/AnnotationProcessorCompiler.java +++ b/src/main/java/org/bsc/maven/plugin/processor/AnnotationProcessorCompiler.java @@ -341,26 +341,28 @@ else if( "-s".equals(option) ) { } else if( option.startsWith("-A") ) { javacConf.addCompilerCustomArgument(option, ""); - } - final java.util.Properties props = project.getProperties(); - - final String sourceVersion = props.getProperty(PROCESSOR_SOURCE,props.getProperty(COMPILER_SOURCE, DEFAULT_SOURCE_VERSION)); - final String targetVersion = props.getProperty(PROCESSOR_TARGET,props.getProperty(COMPILER_TARGET, DEFAULT_TARGET_VERSION)); - - javacConf.setSourceVersion(sourceVersion ); - javacConf.setTargetVersion(targetVersion); - javacConf.setWorkingDirectory(project.getBasedir()); - - final java.util.Set sourceFiles = - new java.util.HashSet(); - for( JavaFileObject src : compilationUnits ) { - sourceFiles.add( new java.io.File( src.toUri() ) ); - + else { + // Just pass through any other arguments + javacConf.addCompilerCustomArgument(option, ""); } - - javacConf.setSourceFiles(sourceFiles); } + final java.util.Properties props = project.getProperties(); + + final String sourceVersion = props.getProperty(PROCESSOR_SOURCE,props.getProperty(COMPILER_SOURCE, DEFAULT_SOURCE_VERSION)); + final String targetVersion = props.getProperty(PROCESSOR_TARGET,props.getProperty(COMPILER_TARGET, DEFAULT_TARGET_VERSION)); + + javacConf.setSourceVersion(sourceVersion ); + javacConf.setTargetVersion(targetVersion); + javacConf.setWorkingDirectory(project.getBasedir()); + + final java.util.Set sourceFiles = + new java.util.HashSet(); + for( JavaFileObject src : compilationUnits ) { + sourceFiles.add( new java.io.File( src.toUri() ) ); + } + + javacConf.setSourceFiles(sourceFiles); javacConf.setDebug(false); javacConf.setFork(true); javacConf.setVerbose(false); From d22ab3b8a0be5b33478a000c68dc786d195b717a Mon Sep 17 00:00:00 2001 From: Christian Beikov Date: Thu, 7 Sep 2017 12:22:49 +0200 Subject: [PATCH 2/2] Windows path separator fix --- .../bsc/maven/plugin/processor/AnnotationProcessorCompiler.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/bsc/maven/plugin/processor/AnnotationProcessorCompiler.java b/src/main/java/org/bsc/maven/plugin/processor/AnnotationProcessorCompiler.java index 2890a64..a3f4331 100644 --- a/src/main/java/org/bsc/maven/plugin/processor/AnnotationProcessorCompiler.java +++ b/src/main/java/org/bsc/maven/plugin/processor/AnnotationProcessorCompiler.java @@ -314,7 +314,7 @@ private void execute( final Iterable options, javacConf.addClasspathEntry(ii.next()); } else if( "-sourcepath".equals(option) ) { - String [] sourceLocations = ii.next().split(":"); + String [] sourceLocations = ii.next().split(java.util.regex.Pattern.quote(java.io.File.pathSeparator)); for( String path : sourceLocations ) { final java.io.File dir = new java.io.File( path );