This component is an Compilation API used by Apache Maven Compiler plugin on the top of different Compiler Engines: Javac, Eclipse Compiler, etc..
Please refer to documentation
Or the project it test
Plexus compiler a layer on top of compilers and used by maven-compiler-plugin
Home Page: https://codehaus-plexus.github.io/plexus-compiler/
This component is an Compilation API used by Apache Maven Compiler plugin on the top of different Compiler Engines: Javac, Eclipse Compiler, etc..
Please refer to documentation
Or the project it test
Hi,
my pom.xml for the maven compiler plugin looks like this:
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<compilerId>eclipse</compilerId>
<source>1.8</source>
<target>1.8</target>
<encoding>UTF-8</encoding>
</configuration>
<dependencies>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-compiler-eclipse</artifactId>
<version>2.8.1</version>
</dependency>
</dependencies>
But running mvn clean verify
results in following error: MYFILE:[57] System cannot be resolved
I've simply followed the instructions here
Any idea why the compiler can't resolve System
?
Regards
Hello
Currently, the plexus-csharp-compile is taking src/main/java
as the default source directory. Making src/main/csharp the default directory would let csharp compiling phase activated within a profile by
<profile>
<id>csharp-comp</id>
<activation>
<file>
<exists>${basedir}/src/main/csharp</exists>
</file>
</activation>
</profile>
instead of
<profile>
<id>csharp-comp</id>
<activation>
<file>
<exists>${basedir}/src/main/java</exists>
</file>
</activation>
</profile>
which is misnamed
Eclipse will soon release its next version (4.5 Mars). Its compiler provider better compatibility with Java 8.
I will create a pull request for this as soon as ecj 4.5 is available on maven (scheduled for June 24).
Hello,
Currently it is not possible to issue an:
mvn clean package
due to a the following error:
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running org.codehaus.plexus.compiler.j2objc.J2ObjCCompilerTest
Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.07 sec <<< FAILURE! - in org.codehaus.plexus.compiler.j2objc.J2ObjCCompilerTest
testJ2ObjCCompiler(org.codehaus.plexus.compiler.j2objc.J2ObjCCompilerTest) Time elapsed: 0.06 sec <<< FAILURE!
junit.framework.AssertionFailedError
at junit.framework.Assert.fail(Assert.java:47)
at junit.framework.Assert.assertTrue(Assert.java:20)
at junit.framework.Assert.assertTrue(Assert.java:27)
at org.codehaus.plexus.compiler.j2objc.J2ObjCCompilerTest.testJ2ObjCCompiler(J2ObjCCompilerTest.java:62)
Results :
Failed tests:
org.codehaus.plexus.compiler.j2objc.J2ObjCCompilerTest#testJ2ObjCCompiler AssertionFailedError
Tests run: 1, Failures: 1, Errors: 0, Skipped: 0
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] Plexus Compiler ................................... SUCCESS [ 1.489 s]
[INFO] Plexus Compiler Api ............................... SUCCESS [ 2.257 s]
[INFO] Plexus Compiler Manager ........................... SUCCESS [ 0.707 s]
[INFO] Plexus Compiler Test Harness ...................... SUCCESS [ 0.302 s]
[INFO] Plexus Compilers .................................. SUCCESS [ 0.024 s]
[INFO] Plexus AspectJ Compiler ........................... SUCCESS [ 2.037 s]
[INFO] Plexus C# Compiler ................................ SUCCESS [ 0.538 s]
[INFO] Plexus Eclipse Compiler ........................... SUCCESS [ 1.722 s]
[INFO] Plexus Jikes Compiler ............................. SUCCESS [ 0.172 s]
[INFO] Plexus Javac Component ............................ SUCCESS [ 2.423 s]
[INFO] Plexus Javac+error-prone Component ................ SUCCESS [ 0.199 s]
[INFO] Plexus J2ObjC Compiler ............................ FAILURE [ 0.414 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 12.677 s
[INFO] Finished at: 2015-05-25T21:09:55+01:00
[INFO] Final Memory: 32M/450M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.17:test (default-test) on project plexus-compiler-j2objc: There are test failures.
[ERROR]
[ERROR] Please refer to /Users/montoyaedu/plexus-compiler/plexus-compilers/plexus-compiler-j2objc/target/surefire-reports for the individual test results.
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <goals> -rf :plexus-compiler-j2objc
It works by issuing:
mvn -DskipTests=true
Just wondering if this behaviour known and wanted.
Regards,
EthicLab.
I am not very good at English
I want use my own jar . It is in /src/main/webapp/WEB-INF/lib/myJar.jar
when i use this
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
<encoding>UTF-8</encoding>
<compilerArguments>
<verbose />
<bootclasspath>${env.JAVA_HOME}/jre/lib/rt.jar</bootclasspath>
<extdirs>${project.basedir}/src/main/webapp/WEB-INF/lib</extdirs>
</compilerArguments>
</configuration>
</plugin>
It is works! /src/main/webapp/WEB-INF/lib/myJar.jar
can be ues 。
But for some reason i must use plexus-compiler-eclipse,like this:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
<encoding>UTF-8</encoding>
<compilerId>eclipse</compilerId>
<compilerArguments>
<verbose />
<bootclasspath>${env.JAVA_HOME}/jre/lib/rt.jar</bootclasspath>
<extdirs>${project.basedir}/src/main/webapp/WEB-INF/lib</extdirs>
</compilerArguments>
</configuration>
<dependencies>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-compiler-eclipse</artifactId>
<version>2.2</version>
</dependency>
</dependencies>
</plugin>
when it use this option in my pom.xml,it not works!
So when I use plexus-compiler-eclipse to compile my project, how to use my own jar!
Think you!
Sometimes it is difficult to set up the plugin configuration in a way to support different JDKs (maybe even using toolchains). For example look at MPOM-264. To ease that the JavacCompiler should only use the -release
parameter with version 9 or above as using it with earlier versions leads to errors.
An additional condition should be added to
Adding an option that can cause all of the output generated by Javac could make users better able to figure out what is happening when they face issues such as #37 and #20 and increase their confidence in depending on this code.
While fixing such parsing issues is good, there is nothing to prove the parsing is perfect or nothing to prevent the output from changing and breaking the parsing in the future, just this option would continue to be useful.
If I do a version bump from 2.8.8
to 2.9.0
, I get the following stack trace:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project project-name: Execution default-compile of goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile failed: An API incompatibility was encountered while executing org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile: java.lang.NoSuchMethodError: org.codehaus.plexus.compiler.CompilerConfiguration.getProcessorModulePathEntries()Ljava/util/List;
[ERROR] -----------------------------------------------------
[ERROR] realm = plugin>org.apache.maven.plugins:maven-compiler-plugin:3.8.1
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
[ERROR] urls[0] = file:/Users/someuser/.m2/repository/org/apache/maven/plugins/maven-compiler-plugin/3.8.1/maven-compiler-plugin-3.8.1.jar
[ERROR] urls[1] = file:/Users/someuser/.m2/repository/org/codehaus/plexus/plexus-compiler-eclipse/2.9.0/plexus-compiler-eclipse-2.9.0.jar
[ERROR] urls[2] = file:/Users/someuser/.m2/repository/org/codehaus/plexus/plexus-utils/3.3.0/plexus-utils-3.3.0.jar
[ERROR] urls[3] = file:/Users/someuser/.m2/repository/org/eclipse/jdt/ecj/3.24.0/ecj-3.24.0.jar
[ERROR] urls[4] = file:/Users/someuser/.m2/repository/org/codehaus/plexus/plexus-component-annotations/1.7.1/plexus-component-annotations-1.7.1.jar
[ERROR] urls[5] = file:/Users/someuser/.m2/repository/org/sonatype/sisu/sisu-inject-bean/1.4.2/sisu-inject-bean-1.4.2.jar
[ERROR] urls[6] = file:/Users/someuser/.m2/repository/org/sonatype/sisu/sisu-guice/2.1.7/sisu-guice-2.1.7-noaop.jar
[ERROR] urls[7] = file:/Users/someuser/.m2/repository/org/sonatype/aether/aether-util/1.7/aether-util-1.7.jar
[ERROR] urls[8] = file:/Users/someuser/.m2/repository/org/codehaus/plexus/plexus-interpolation/1.14/plexus-interpolation-1.14.jar
[ERROR] urls[9] = file:/Users/someuser/.m2/repository/org/sonatype/plexus/plexus-sec-dispatcher/1.3/plexus-sec-dispatcher-1.3.jar
[ERROR] urls[10] = file:/Users/someuser/.m2/repository/org/sonatype/plexus/plexus-cipher/1.4/plexus-cipher-1.4.jar
[ERROR] urls[11] = file:/Users/someuser/.m2/repository/org/apache/maven/shared/maven-shared-utils/3.2.1/maven-shared-utils-3.2.1.jar
[ERROR] urls[12] = file:/Users/someuser/.m2/repository/commons-io/commons-io/2.5/commons-io-2.5.jar
[ERROR] urls[13] = file:/Users/someuser/.m2/repository/org/apache/maven/shared/maven-shared-incremental/1.1/maven-shared-incremental-1.1.jar
[ERROR] urls[14] = file:/Users/someuser/.m2/repository/org/codehaus/plexus/plexus-java/0.9.10/plexus-java-0.9.10.jar
[ERROR] urls[15] = file:/Users/someuser/.m2/repository/org/ow2/asm/asm/6.2/asm-6.2.jar
[ERROR] urls[16] = file:/Users/someuser/.m2/repository/com/thoughtworks/qdox/qdox/2.0-M9/qdox-2.0-M9.jar
[ERROR] urls[17] = file:/Users/someuser/.m2/repository/org/codehaus/plexus/plexus-compiler-api/2.8.4/plexus-compiler-api-2.8.4.jar
[ERROR] urls[18] = file:/Users/someuser/.m2/repository/org/codehaus/plexus/plexus-compiler-manager/2.8.4/plexus-compiler-manager-2.8.4.jar
[ERROR] urls[19] = file:/Users/someuser/.m2/repository/org/codehaus/plexus/plexus-compiler-javac/2.8.4/plexus-compiler-javac-2.8.4.jar
[ERROR] Number of foreign imports: 1
[ERROR] import: Entry[import from realm ClassRealm[maven.api, parent: null]]
[ERROR]
[ERROR] -----------------------------------------------------
POM file section for maven-compiler-plugin
looks like:
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<compilerId>eclipse</compilerId>
</configuration>
<dependencies>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-compiler-eclipse</artifactId>
<version>2.9.0</version>
</dependency>
</dependencies>
</plugin>
Looks like getProcessorModulePathEntries
was added in this commit.
Any help is appreciated.
Hello,
Good day. I have a maven project having the maven compiler plugin 2.5.1 for compiling the source during the build. When the JAVA_HOME variable points to JDK 8 installation directory (C:\DevEnv\ProgramFiles\Java\jdk1.8.0_20), im getting the error message Unable to locate the Javac Compiler in C:\DevEnv\ProgramFiles\Java\jdk1.8.0_20..\lib\tools.jar . The same runs with the Java 7 without any problem.
Observations :
when debugged, it ended up in the file JavacCompiler.java of artifact plexus-compiler-javac. The line System.getProperty( "java.home" ) in the compile process outputs differently for Java 8 and Java 7
For Java 7 - C:\DevEnv\ProgramFiles\Java\jdk1.7.0_80\jre
For Java 8 - C:\DevEnv\ProgramFiles\Java\jdk1.8.0_20
can you provide a fix to this ?
I first reported this issue on the Maven Compiler Plugin (https://issues.apache.org/jira/browse/MCOMPILER-407) and it was suggested that the fix needs to happen here first.
Certain Java annotation processors and compiler plugins like The Checker Framework can print useful diagnostics on stdout. Currently, there is no way to see this output using the Maven Compiler Plugin, even when Maven is run with the -X
option. I suggest that when Maven is in debug mode, there should be a debug message printed with the full stdout of the Java compiler. This should also work if the compiler is forked.
If someone points me at the relevant code, I am happy to try to submit a pull request for this change.
Hi, it would be fine to also have a compiler implementation for the J2ObjC framework ( http://j2objc.org/ ). I've began to do one that i will contribute when it will be usable, it is hosted on my fork of your repo but it's just a POC right now.
When the javac of Java 6 (6_45) finds a class file with newer version number, it aborts the build with the following error on STDERR:
bad class file: com\modern\Offending.class(com\modern:Offending.class)
class file has wrong version 52.0, should be 50.0
Please remove or make sure it appears in the correct subdirectory of the classpath.
import com.modern.Offending;
^
It seems plexus-compiler is not able to parse this error. When running the maven-compiler-plugin
, this is silently swallowed and the user is left guessing why her build failed...
Newer version of Java (tested with Java 7_60) just show a warning, which is parsed correctly.
So if your JDK is 8 and you have a 8, it should be ignored. This allows for parent POMs to be specified that can be used both with Java 8 or earlier, and Java 9 or later.
The current source tree appears to expect that J2ObjC will be installed and fails to build if it is not available.
Either J2ObjC should be made optional or J2ObjC should be pulled as a dependency automatically. At minimum the requirements for installed components needed to build plexus-compiler should be specified as the failure is quite opaque.
The error-prone compiler doesn't respect the actual toolchain in the Maven build. For example: if I launch Maven with JDK 9, but the toolchain is set to JDK 8, error-prone will still use JDK 9's javac.
Hi,
I'd like to know is there some examples to show how to use csharp compiler?
I followed the official website and can only find the settings in pom.xml:
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<compilerId>csharp</compilerId>
</configuration>
<dependencies>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-compiler-csharp</artifactId>
<version>1.8</version>
</dependency>
</dependencies>
</plugin>
Then, I put my .cs file into src/main/java and run mvn compile
, error message is :
Fatal error compiling: This compiler doesn't support in-process compilation. -> [Help 1]
I tried to put my .csproj file under the same folder but the error still exists. ( do I still need the .csproj file ? If not ,how to claim dependencies in pom.xml?)
My OS is MacOS and install the dotnet SDK by following https://code.visualstudio.com/docs/languages/csharp
Many Thanks.
This is because of the bug1 and bug2. Although it can be fixed immediately by the eclipse team, I think they will not fix it. The bug2 was reported 7 month ago and two new version released. A workround is using processormodulepath instead of processorpath. ( Perhaps introduce side effect. ) However, the maven does not support processormodulepath option. So the workaround should be placed in the plugin.
For example the plugin provide an option to decide whether processorpath should be replaced with processormodulepath.
It is possible to have both --process-module-path
and --process-path
, so the configurationConfiguration should support both options. Thsi is similar to the separation of classpath and modulepath, where e.g. the maven-compiler-plugin is responsible for dividing the jars over both paths.
[WARNING] Error injecting: org.codehaus.plexus.compiler.javac.errorprone.JavacCompilerWithErrorProne
java.lang.NoClassDefFoundError: org/codehaus/plexus/compiler/javac/InProcessCompiler
but it fails compilation with
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project ...: Execution default-compile of goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile failed: A required class was missing while executing org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile: org/codehaus/plexus/compiler/javac/InProcessCompiler
[ERROR] -----------------------------------------------------
[ERROR] realm = plugin>org.apache.maven.plugins:maven-compiler-plugin:3.8.1
...
With this hint the caller can decide which classes should be (re)compiled. In general if incremental compilation is not supported, it is best to recompile everything if something has changed.
(Since Compiler is an interface, this requires Java 8 so a default method can be added)
I have a modular javafx project and would like to use ecj, so I configured it in my pom:
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<dependencies>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-compiler-eclipse</artifactId>
<version>2.8.8</version>
</dependency>
<dependency>
<groupId>org.eclipse.jdt</groupId>
<artifactId>ecj</artifactId>
<version>3.26.0</version>
</dependency>
</dependencies>
I immediately get lots of errors, both concerning missing modules (e.g. cannot find javafx.controls) and types within my own module that cannot be resolved (classes in the same package). When running maven (with javac) and the -X options I see that maven itself seems to be aware of the modules and that the information is passed along to javac:
[DEBUG] Classpath:
[DEBUG] /Users/hal/java/git/tdt4100-2021/sensur-kont2021/candidates/10001/target/classes
[DEBUG] /Users/hal/.m2/repository/org/openjfx/javafx-fxml/16/javafx-fxml-16.jar
[DEBUG] /Users/hal/.m2/repository/org/openjfx/javafx-controls/16/javafx-controls-16.jar
[DEBUG] /Users/hal/.m2/repository/org/openjfx/javafx-graphics/16/javafx-graphics-16.jar
[DEBUG] /Users/hal/.m2/repository/org/openjfx/javafx-base/16/javafx-base-16.jar
[DEBUG] Modulepath:
[DEBUG] /Users/hal/.m2/repository/org/openjfx/javafx-fxml/16/javafx-fxml-16-mac.jar
[DEBUG] /Users/hal/.m2/repository/org/openjfx/javafx-controls/16/javafx-controls-16-mac.jar
[DEBUG] /Users/hal/.m2/repository/org/openjfx/javafx-graphics/16/javafx-graphics-16-mac.jar
[DEBUG] /Users/hal/.m2/repository/org/openjfx/javafx-base/16/javafx-base-16-mac.jar
[DEBUG] Source roots:
[DEBUG] /Users/hal/java/git/tdt4100-2021/sensur-kont2021/candidates/10001/src/main/java
[DEBUG] /Users/hal/java/git/tdt4100-2021/sensur-kont2021/candidates/10001/target/generated-sources/annotations
[DEBUG] Command line options:
[DEBUG] -d /Users/hal/java/git/tdt4100-2021/sensur-kont2021/candidates/10001/target/classes -classpath /Users/hal/java/git/tdt4100-2021/sensur-kont2021/candidates/10001/target/classes:/Users/hal/.m2/repository/org/openjfx/javafx-fxml/16/javafx-fxml-16.jar:/Users/hal/.m2/repository/org/openjfx/javafx-controls/16/javafx-controls-16.jar:/Users/hal/.m2/repository/org/openjfx/javafx-graphics/16/javafx-graphics-16.jar:/Users/hal/.m2/repository/org/openjfx/javafx-base/16/javafx-base-16.jar: --module-path /Users/hal/.m2/repository/org/openjfx/javafx-fxml/16/javafx-fxml-16-mac.jar:/Users/hal/.m2/repository/org/openjfx/javafx-controls/16/javafx-controls-16-mac.jar:/Users/hal/.m2/repository/org/openjfx/javafx-graphics/16/javafx-graphics-16-mac.jar:/Users/hal/.m2/repository/org/openjfx/javafx-base/16/javafx-base-16-mac.jar: -sourcepath /Users/hal/java/git/tdt4100-2021/sensur-kont2021/candidates/10001/src/main/java:/Users/hal/java/git/tdt4100-2021/sensur-kont2021/candidates/10001/target/generated-sources/annotations: -s /Users/hal/java/git/tdt4100-2021/sensur-kont2021/candidates/10001/target/generated-sources/annotations -g -nowarn --release 15 --module-version 0.0.1-SNAPSHOT
Compilation works for javac with these options.
However, the corresponding output for ecj is as follows:
[DEBUG] Classpath:
[DEBUG] /Users/hal/.m2/repository/org/openjfx/javafx-fxml/16/javafx-fxml-16.jar
[DEBUG] /Users/hal/.m2/repository/org/openjfx/javafx-controls/16/javafx-controls-16.jar
[DEBUG] /Users/hal/.m2/repository/org/openjfx/javafx-graphics/16/javafx-graphics-16.jar
[DEBUG] /Users/hal/.m2/repository/org/openjfx/javafx-base/16/javafx-base-16.jar
[DEBUG] Modulepath:
[DEBUG] /Users/hal/java/git/tdt4100-2021/sensur-kont2021/candidates/10001/target/classes
[DEBUG] /Users/hal/.m2/repository/org/openjfx/javafx-fxml/16/javafx-fxml-16-mac.jar
[DEBUG] /Users/hal/.m2/repository/org/openjfx/javafx-controls/16/javafx-controls-16-mac.jar
[DEBUG] /Users/hal/.m2/repository/org/openjfx/javafx-graphics/16/javafx-graphics-16-mac.jar
[DEBUG] /Users/hal/.m2/repository/org/openjfx/javafx-base/16/javafx-base-16-mac.jar
[DEBUG] Source roots:
[DEBUG] /Users/hal/java/git/tdt4100-2021/sensur-kont2021/candidates/10001/src/main/java
[DEBUG] /Users/hal/java/git/tdt4100-2021/sensur-kont2021/candidates/10001/target/generated-sources/annotations
[WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!
[DEBUG] incrementalBuildHelper#beforeRebuildExecution
[DEBUG] Using JSR-199 EclipseCompiler
[DEBUG] ecj: using character set UTF-8
[DEBUG] ecj command line: [-noExit, -preserveAllLocals, -g:lines,vars,source, --release, 15, -warn:none, -properties, /Users/hal/java/git/tdt4100-2021/sensur-kont2021/candidates/10001/../../template/.settings/org.eclipse.jdt.core.prefs, -proceedOnError, -verbose, --module-version, 0.0.1-SNAPSHOT, -d, /Users/hal/java/git/tdt4100-2021/sensur-kont2021/candidates/10001/target/classes, -proceedOnError:Fatal, -classpath, /Users/hal/.m2/repository/org/openjfx/javafx-fxml/16/javafx-fxml-16.jar:/Users/hal/.m2/repository/org/openjfx/javafx-controls/16/javafx-controls-16.jar:/Users/hal/.m2/repository/org/openjfx/javafx-graphics/16/javafx-graphics-16.jar:/Users/hal/.m2/repository/org/openjfx/javafx-base/16/javafx-base-16.jar:/Users/hal/java/git/tdt4100-2021/sensur-kont2021/candidates/10001/target/classes:]
There is no trace of the modules in the command line options. Inspecting the code, this isn't surprising as the code doesn't seem to look for or handle module-path related stuff. I assume the maven's module path information is available, so wonder why it's not used?
It is currently not possible to pass argument files to javac
like so:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<compilerArgs>
<!-- NOPE! 😢 -->
<arg>@somefile</arg>
</compilerArgs>
</configuration>
</plugin>
The reason is that JavacCompiler
creates its own temporary argument file, including @somefile
but recursive @
s are not supported by javac
. The obvious (only?) solution would be to give the compiler a separate option for argument files that are not included into the temporary one, e.g:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<!-- strawman syntax! -->
<compilerArgFiles>
<argFile>@somefile</argFile>
</compilerArgs>
</configuration>
</plugin>
Per Robert Scholte https://issues.apache.org/jira/browse/MCOMPILER-367 can only be fixed in this plugin.
Here is the problem description:
I will attach a testcase showing the following problem.
If you compile a project that has compiler warnings, javac's output indicates which Xlint option will suppress the warning. But when compiling the same code under this plugin, this vital information is suppressed so the user has a difficult time figuring out which option to use.
Expected behavior: output should indicate which Xlint option corresponds to the warning.
Running mvn compile on the testcase results in:
[INFO] — maven-compiler-plugin:3.8.0:compile (default-compile) @ testcase —
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 2 source files to C:\Users\Gili\Documents\3rdparty\testcase\target\classes
[WARNING] /C:/Users/Gili/Documents/3rdparty/testcase/src/main/java/module-info.java:[2,32] module not found: someOtherModule
I then run the following compilation:
javac -d C:\Users\Gili\Documents\3rdparty\testcase\target\classes -classpath C:\Users\Gili\Documents\3rdparty\testcase\target\classes; -sourcepath C:\Users\Gili\Documents\3rdparty\testcase\src\main\java;C:\Users\Gili\Documents\3rdparty\testcase\target\generated-sources\annotations; -s C:\Users\Gili\Documents\3rdparty\testcase\target\generated-sources\annotations -g -target 11 -source 11 -encoding UTF-8 com\company\SomeClass.java module-info.java
I get:
module-info.java:2: warning: [module] module not found: someOtherModule
exports com.company to someOtherModule;
^
1 warning
Notice that the javac output includes "[module]" at the beginning of the warning message. This indicates that "-Xlint:-module" will suppress this warning. I am expecting maven-plugin-compiler to show this information in its output.
Please let me know if have any questions and/or would like me to attach the testcase here.
Hello,
It seems we are not java 1.6 compatible anymore. Is it desired?
Issuing
mvn -X clean package
With the following environment.
Apache Maven 3.2.1 (ea8b2b07643dbb1b84b6d16e1f08391b666bc1e9; 2014-02-14T18:37:52+01:00)
Maven home: /usr/local/Cellar/maven/3.2.1/libexec
Java version: 1.6.0_65, vendor: Apple Inc.
Java home: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
Default locale: en_US, platform encoding: MacRoman
OS name: "mac os x", version: "10.10.3", arch: "x86_64", family: "mac"
Gives the following compilation errors.
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] Plexus Compiler
[INFO] Plexus Compiler Api
[INFO] Plexus Compiler Manager
[INFO] Plexus Compiler Test Harness
[INFO] Plexus Compilers
[INFO] Plexus AspectJ Compiler
[INFO] Plexus C# Compiler
[INFO] Plexus Eclipse Compiler
[INFO] Plexus Jikes Compiler
[INFO] Plexus Javac Component
[INFO] Plexus Javac+error-prone Component
[INFO] Plexus J2ObjC Compiler
[INFO]
[INFO] Using the builder org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder with a thread count of 1
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Plexus Compiler 2.6-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ plexus-compiler ---
[INFO] Deleting /Users/montoyaedu/plexus-compiler/target
[INFO]
[INFO] --- plexus-component-metadata:1.5.5:generate-metadata (process-classes) @ plexus-compiler ---
[INFO]
[INFO] --- plexus-component-metadata:1.5.5:generate-metadata (default) @ plexus-compiler ---
[INFO]
[INFO] --- plexus-component-metadata:1.5.5:merge-metadata (default) @ plexus-compiler ---
[INFO]
[INFO] --- plexus-component-metadata:1.5.5:generate-test-metadata (process-test-classes) @ plexus-compiler ---
[INFO]
[INFO] --- maven-site-plugin:3.4:attach-descriptor (attach-descriptor) @ plexus-compiler ---
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Plexus Compiler Api 2.6-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ plexus-compiler-api ---
[INFO] Deleting /Users/montoyaedu/plexus-compiler/plexus-compiler-api/target
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ plexus-compiler-api ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /Users/montoyaedu/plexus-compiler/plexus-compiler-api/src/main/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ plexus-compiler-api ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 18 source files to /Users/montoyaedu/plexus-compiler/plexus-compiler-api/target/classes
[WARNING] Note: Some input files use or override a deprecated API.
[WARNING] Note: Recompile with -Xlint:deprecation for details.
[INFO]
[INFO] --- plexus-component-metadata:1.5.5:generate-metadata (process-classes) @ plexus-compiler-api ---
[INFO]
[INFO] --- plexus-component-metadata:1.5.5:generate-metadata (default) @ plexus-compiler-api ---
[INFO]
[INFO] --- plexus-component-metadata:1.5.5:merge-metadata (default) @ plexus-compiler-api ---
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ plexus-compiler-api ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ plexus-compiler-api ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 4 source files to /Users/montoyaedu/plexus-compiler/plexus-compiler-api/target/test-classes
[INFO]
[INFO] --- plexus-component-metadata:1.5.5:generate-test-metadata (process-test-classes) @ plexus-compiler-api ---
[INFO]
[INFO] --- maven-surefire-plugin:2.17:test (default-test) @ plexus-compiler-api ---
[INFO] Surefire report directory: /Users/montoyaedu/plexus-compiler/plexus-compiler-api/target/surefire-reports
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running org.codehaus.plexus.compiler.util.scan.mapping.SuffixMappingTest
Tests run: 5, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.005 sec - in org.codehaus.plexus.compiler.util.scan.mapping.SuffixMappingTest
Running org.codehaus.plexus.compiler.util.scan.SimpleSourceInclusionScannerTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.01 sec - in org.codehaus.plexus.compiler.util.scan.SimpleSourceInclusionScannerTest
Running org.codehaus.plexus.compiler.util.scan.StaleSourceScannerTest
Tests run: 10, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.04 sec - in org.codehaus.plexus.compiler.util.scan.StaleSourceScannerTest
Results :
Tests run: 16, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ plexus-compiler-api ---
[INFO] Building jar: /Users/montoyaedu/plexus-compiler/plexus-compiler-api/target/plexus-compiler-api-2.6-SNAPSHOT.jar
[INFO]
[INFO] --- maven-site-plugin:3.4:attach-descriptor (attach-descriptor) @ plexus-compiler-api ---
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Plexus Compiler Manager 2.6-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ plexus-compiler-manager ---
[INFO] Deleting /Users/montoyaedu/plexus-compiler/plexus-compiler-manager/target
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ plexus-compiler-manager ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /Users/montoyaedu/plexus-compiler/plexus-compiler-manager/src/main/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ plexus-compiler-manager ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 3 source files to /Users/montoyaedu/plexus-compiler/plexus-compiler-manager/target/classes
[INFO]
[INFO] --- plexus-component-metadata:1.5.5:generate-metadata (process-classes) @ plexus-compiler-manager ---
[INFO] Discovered 1 component descriptors(s)
[INFO]
[INFO] --- plexus-component-metadata:1.5.5:generate-metadata (default) @ plexus-compiler-manager ---
[INFO] Discovered 1 component descriptors(s)
[INFO]
[INFO] --- plexus-component-metadata:1.5.5:merge-metadata (default) @ plexus-compiler-manager ---
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ plexus-compiler-manager ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /Users/montoyaedu/plexus-compiler/plexus-compiler-manager/src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ plexus-compiler-manager ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to /Users/montoyaedu/plexus-compiler/plexus-compiler-manager/target/test-classes
[INFO]
[INFO] --- plexus-component-metadata:1.5.5:generate-test-metadata (process-test-classes) @ plexus-compiler-manager ---
[INFO]
[INFO] --- maven-surefire-plugin:2.17:test (default-test) @ plexus-compiler-manager ---
[INFO] Surefire report directory: /Users/montoyaedu/plexus-compiler/plexus-compiler-manager/target/surefire-reports
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running org.codehaus.plexus.compiler.manager.CompilerManagerTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.204 sec - in org.codehaus.plexus.compiler.manager.CompilerManagerTest
Results :
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ plexus-compiler-manager ---
[INFO] Building jar: /Users/montoyaedu/plexus-compiler/plexus-compiler-manager/target/plexus-compiler-manager-2.6-SNAPSHOT.jar
[INFO]
[INFO] --- maven-site-plugin:3.4:attach-descriptor (attach-descriptor) @ plexus-compiler-manager ---
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Plexus Compiler Test Harness 2.6-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ plexus-compiler-test ---
[INFO] Deleting /Users/montoyaedu/plexus-compiler/plexus-compiler-test/target
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ plexus-compiler-test ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /Users/montoyaedu/plexus-compiler/plexus-compiler-test/src/main/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ plexus-compiler-test ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 2 source files to /Users/montoyaedu/plexus-compiler/plexus-compiler-test/target/classes
[INFO]
[INFO] --- plexus-component-metadata:1.5.5:generate-metadata (process-classes) @ plexus-compiler-test ---
[INFO]
[INFO] --- plexus-component-metadata:1.5.5:generate-metadata (default) @ plexus-compiler-test ---
[INFO]
[INFO] --- plexus-component-metadata:1.5.5:merge-metadata (default) @ plexus-compiler-test ---
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ plexus-compiler-test ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /Users/montoyaedu/plexus-compiler/plexus-compiler-test/src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ plexus-compiler-test ---
[INFO] No sources to compile
[INFO]
[INFO] --- plexus-component-metadata:1.5.5:generate-test-metadata (process-test-classes) @ plexus-compiler-test ---
[INFO]
[INFO] --- maven-surefire-plugin:2.17:test (default-test) @ plexus-compiler-test ---
[INFO] No tests to run.
[INFO]
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ plexus-compiler-test ---
[INFO] Building jar: /Users/montoyaedu/plexus-compiler/plexus-compiler-test/target/plexus-compiler-test-2.6-SNAPSHOT.jar
[INFO]
[INFO] --- maven-site-plugin:3.4:attach-descriptor (attach-descriptor) @ plexus-compiler-test ---
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Plexus Compilers 2.6-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ plexus-compilers ---
[INFO]
[INFO] --- plexus-component-metadata:1.5.5:generate-metadata (process-classes) @ plexus-compilers ---
[INFO]
[INFO] --- plexus-component-metadata:1.5.5:generate-metadata (default) @ plexus-compilers ---
[INFO]
[INFO] --- plexus-component-metadata:1.5.5:merge-metadata (default) @ plexus-compilers ---
[INFO]
[INFO] --- plexus-component-metadata:1.5.5:generate-test-metadata (process-test-classes) @ plexus-compilers ---
[INFO]
[INFO] --- maven-site-plugin:3.4:attach-descriptor (attach-descriptor) @ plexus-compilers ---
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Plexus AspectJ Compiler 2.6-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ plexus-compiler-aspectj ---
[INFO] Deleting /Users/montoyaedu/plexus-compiler/plexus-compilers/plexus-compiler-aspectj/target
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ plexus-compiler-aspectj ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /Users/montoyaedu/plexus-compiler/plexus-compilers/plexus-compiler-aspectj/src/main/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ plexus-compiler-aspectj ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 2 source files to /Users/montoyaedu/plexus-compiler/plexus-compilers/plexus-compiler-aspectj/target/classes
[WARNING] Note: /Users/montoyaedu/plexus-compiler/plexus-compilers/plexus-compiler-aspectj/src/main/java/org/codehaus/plexus/compiler/ajc/AspectJCompiler.java uses or overrides a deprecated API.
[WARNING] Note: Recompile with -Xlint:deprecation for details.
[INFO]
[INFO] --- plexus-component-metadata:1.5.5:generate-metadata (process-classes) @ plexus-compiler-aspectj ---
[INFO] Discovered 1 component descriptors(s)
[INFO]
[INFO] --- plexus-component-metadata:1.5.5:generate-metadata (default) @ plexus-compiler-aspectj ---
[INFO] Discovered 1 component descriptors(s)
[INFO]
[INFO] --- plexus-component-metadata:1.5.5:merge-metadata (default) @ plexus-compiler-aspectj ---
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ plexus-compiler-aspectj ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /Users/montoyaedu/plexus-compiler/plexus-compilers/plexus-compiler-aspectj/src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ plexus-compiler-aspectj ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to /Users/montoyaedu/plexus-compiler/plexus-compilers/plexus-compiler-aspectj/target/test-classes
[INFO]
[INFO] --- plexus-component-metadata:1.5.5:generate-test-metadata (process-test-classes) @ plexus-compiler-aspectj ---
[INFO]
[INFO] --- maven-surefire-plugin:2.17:test (default-test) @ plexus-compiler-aspectj ---
[INFO] Surefire report directory: /Users/montoyaedu/plexus-compiler/plexus-compilers/plexus-compiler-aspectj/target/surefire-reports
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running org.codehaus.plexus.compiler.ajc.AspectJCompilerTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.196 sec - in org.codehaus.plexus.compiler.ajc.AspectJCompilerTest
Results :
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ plexus-compiler-aspectj ---
[INFO] Building jar: /Users/montoyaedu/plexus-compiler/plexus-compilers/plexus-compiler-aspectj/target/plexus-compiler-aspectj-2.6-SNAPSHOT.jar
[INFO]
[INFO] --- maven-site-plugin:3.4:attach-descriptor (attach-descriptor) @ plexus-compiler-aspectj ---
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Plexus C# Compiler 2.6-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ plexus-compiler-csharp ---
[INFO] Deleting /Users/montoyaedu/plexus-compiler/plexus-compilers/plexus-compiler-csharp/target
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ plexus-compiler-csharp ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /Users/montoyaedu/plexus-compiler/plexus-compilers/plexus-compiler-csharp/src/main/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ plexus-compiler-csharp ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 2 source files to /Users/montoyaedu/plexus-compiler/plexus-compilers/plexus-compiler-csharp/target/classes
[WARNING] Note: Some input files use or override a deprecated API.
[WARNING] Note: Recompile with -Xlint:deprecation for details.
[INFO]
[INFO] --- plexus-component-metadata:1.5.5:generate-metadata (process-classes) @ plexus-compiler-csharp ---
[INFO] Discovered 1 component descriptors(s)
[INFO]
[INFO] --- plexus-component-metadata:1.5.5:generate-metadata (default) @ plexus-compiler-csharp ---
[INFO] Discovered 1 component descriptors(s)
[INFO]
[INFO] --- plexus-component-metadata:1.5.5:merge-metadata (default) @ plexus-compiler-csharp ---
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ plexus-compiler-csharp ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /Users/montoyaedu/plexus-compiler/plexus-compilers/plexus-compiler-csharp/src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ plexus-compiler-csharp ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to /Users/montoyaedu/plexus-compiler/plexus-compilers/plexus-compiler-csharp/target/test-classes
[INFO]
[INFO] --- plexus-component-metadata:1.5.5:generate-test-metadata (process-test-classes) @ plexus-compiler-csharp ---
[INFO]
[INFO] --- maven-surefire-plugin:2.17:test (default-test) @ plexus-compiler-csharp ---
[INFO] Surefire report directory: /Users/montoyaedu/plexus-compiler/plexus-compilers/plexus-compiler-csharp/target/surefire-reports
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running org.codehaus.plexus.compiler.csharp.CSharpCompilerTest
Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.032 sec - in org.codehaus.plexus.compiler.csharp.CSharpCompilerTest
Results :
Tests run: 3, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ plexus-compiler-csharp ---
[INFO] Building jar: /Users/montoyaedu/plexus-compiler/plexus-compilers/plexus-compiler-csharp/target/plexus-compiler-csharp-2.6-SNAPSHOT.jar
[INFO]
[INFO] --- maven-site-plugin:3.4:attach-descriptor (attach-descriptor) @ plexus-compiler-csharp ---
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Plexus Eclipse Compiler 2.6-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ plexus-compiler-eclipse ---
[INFO] Deleting /Users/montoyaedu/plexus-compiler/plexus-compilers/plexus-compiler-eclipse/target
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ plexus-compiler-eclipse ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /Users/montoyaedu/plexus-compiler/plexus-compilers/plexus-compiler-eclipse/src/main/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ plexus-compiler-eclipse ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 2 source files to /Users/montoyaedu/plexus-compiler/plexus-compilers/plexus-compiler-eclipse/target/classes
[WARNING] Note: /Users/montoyaedu/plexus-compiler/plexus-compilers/plexus-compiler-eclipse/src/main/java/org/codehaus/plexus/compiler/eclipse/EclipseJavaCompiler.java uses or overrides a deprecated API.
[WARNING] Note: Recompile with -Xlint:deprecation for details.
[INFO]
[INFO] --- plexus-component-metadata:1.5.5:generate-metadata (process-classes) @ plexus-compiler-eclipse ---
[INFO] Discovered 1 component descriptors(s)
[INFO]
[INFO] --- plexus-component-metadata:1.5.5:generate-metadata (default) @ plexus-compiler-eclipse ---
[INFO] Discovered 1 component descriptors(s)
[INFO]
[INFO] --- plexus-component-metadata:1.5.5:merge-metadata (default) @ plexus-compiler-eclipse ---
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ plexus-compiler-eclipse ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /Users/montoyaedu/plexus-compiler/plexus-compilers/plexus-compiler-eclipse/src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ plexus-compiler-eclipse ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 2 source files to /Users/montoyaedu/plexus-compiler/plexus-compilers/plexus-compiler-eclipse/target/test-classes
[INFO]
[INFO] --- plexus-component-metadata:1.5.5:generate-test-metadata (process-test-classes) @ plexus-compiler-eclipse ---
[INFO]
[INFO] --- maven-surefire-plugin:2.17:test (default-test) @ plexus-compiler-eclipse ---
[INFO] Surefire report directory: /Users/montoyaedu/plexus-compiler/plexus-compilers/plexus-compiler-eclipse/target/surefire-reports
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running org.codehaus.plexus.compiler.eclipse.EclipseCompilerTckTest
Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.863 sec - in org.codehaus.plexus.compiler.eclipse.EclipseCompilerTckTest
Running org.codehaus.plexus.compiler.eclipse.EclipseCompilerTest
Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.153 sec - in org.codehaus.plexus.compiler.eclipse.EclipseCompilerTest
Results :
Tests run: 5, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ plexus-compiler-eclipse ---
[INFO] Building jar: /Users/montoyaedu/plexus-compiler/plexus-compilers/plexus-compiler-eclipse/target/plexus-compiler-eclipse-2.6-SNAPSHOT.jar
[INFO]
[INFO] --- maven-site-plugin:3.4:attach-descriptor (attach-descriptor) @ plexus-compiler-eclipse ---
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Plexus Jikes Compiler 2.6-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ plexus-compiler-jikes ---
[INFO] Deleting /Users/montoyaedu/plexus-compiler/plexus-compilers/plexus-compiler-jikes/target
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ plexus-compiler-jikes ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /Users/montoyaedu/plexus-compiler/plexus-compilers/plexus-compiler-jikes/src/main/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ plexus-compiler-jikes ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to /Users/montoyaedu/plexus-compiler/plexus-compilers/plexus-compiler-jikes/target/classes
[WARNING] Note: /Users/montoyaedu/plexus-compiler/plexus-compilers/plexus-compiler-jikes/src/main/java/org/codehaus/plexus/compiler/jikes/JikesCompiler.java uses or overrides a deprecated API.
[WARNING] Note: Recompile with -Xlint:deprecation for details.
[INFO]
[INFO] --- plexus-component-metadata:1.5.5:generate-metadata (process-classes) @ plexus-compiler-jikes ---
[INFO] Discovered 1 component descriptors(s)
[INFO]
[INFO] --- plexus-component-metadata:1.5.5:generate-metadata (default) @ plexus-compiler-jikes ---
[INFO] Discovered 1 component descriptors(s)
[INFO]
[INFO] --- plexus-component-metadata:1.5.5:merge-metadata (default) @ plexus-compiler-jikes ---
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ plexus-compiler-jikes ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /Users/montoyaedu/plexus-compiler/plexus-compilers/plexus-compiler-jikes/src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ plexus-compiler-jikes ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to /Users/montoyaedu/plexus-compiler/plexus-compilers/plexus-compiler-jikes/target/test-classes
[INFO]
[INFO] --- plexus-component-metadata:1.5.5:generate-test-metadata (process-test-classes) @ plexus-compiler-jikes ---
[INFO]
[INFO] --- maven-surefire-plugin:2.17:test (default-test) @ plexus-compiler-jikes ---
[INFO] Tests are skipped.
[INFO]
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ plexus-compiler-jikes ---
[INFO] Building jar: /Users/montoyaedu/plexus-compiler/plexus-compilers/plexus-compiler-jikes/target/plexus-compiler-jikes-2.6-SNAPSHOT.jar
[INFO]
[INFO] --- maven-site-plugin:3.4:attach-descriptor (attach-descriptor) @ plexus-compiler-jikes ---
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Plexus Javac Component 2.6-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ plexus-compiler-javac ---
[INFO] Deleting /Users/montoyaedu/plexus-compiler/plexus-compilers/plexus-compiler-javac/target
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ plexus-compiler-javac ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /Users/montoyaedu/plexus-compiler/plexus-compilers/plexus-compiler-javac/src/main/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ plexus-compiler-javac ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 3 source files to /Users/montoyaedu/plexus-compiler/plexus-compilers/plexus-compiler-javac/target/classes
[WARNING] Note: /Users/montoyaedu/plexus-compiler/plexus-compilers/plexus-compiler-javac/src/main/java/org/codehaus/plexus/compiler/javac/JavacCompiler.java uses or overrides a deprecated API.
[WARNING] Note: Recompile with -Xlint:deprecation for details.
[INFO]
[INFO] --- plexus-component-metadata:1.5.5:generate-metadata (process-classes) @ plexus-compiler-javac ---
[INFO] Discovered 1 component descriptors(s)
[INFO]
[INFO] --- plexus-component-metadata:1.5.5:generate-metadata (default) @ plexus-compiler-javac ---
[INFO] Discovered 1 component descriptors(s)
[INFO]
[INFO] --- plexus-component-metadata:1.5.5:merge-metadata (default) @ plexus-compiler-javac ---
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ plexus-compiler-javac ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /Users/montoyaedu/plexus-compiler/plexus-compilers/plexus-compiler-javac/src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ plexus-compiler-javac ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 4 source files to /Users/montoyaedu/plexus-compiler/plexus-compilers/plexus-compiler-javac/target/test-classes
[INFO]
[INFO] --- plexus-component-metadata:1.5.5:generate-test-metadata (process-test-classes) @ plexus-compiler-javac ---
[INFO]
[INFO] --- maven-surefire-plugin:2.17:test (default-test) @ plexus-compiler-javac ---
[INFO] Surefire report directory: /Users/montoyaedu/plexus-compiler/plexus-compilers/plexus-compiler-javac/target/surefire-reports
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running org.codehaus.plexus.compiler.javac.ErrorMessageParserTest
Tests run: 11, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.024 sec - in org.codehaus.plexus.compiler.javac.ErrorMessageParserTest
Running org.codehaus.plexus.compiler.javac.JavacCompilerTest
Tests run: 7, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.774 sec - in org.codehaus.plexus.compiler.javac.JavacCompilerTest
Running org.codehaus.plexus.compiler.javac.JavaxToolsCompilerTest
Tests run: 7, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.203 sec - in org.codehaus.plexus.compiler.javac.JavaxToolsCompilerTest
Results :
Tests run: 25, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ plexus-compiler-javac ---
[INFO] Building jar: /Users/montoyaedu/plexus-compiler/plexus-compilers/plexus-compiler-javac/target/plexus-compiler-javac-2.6-SNAPSHOT.jar
[INFO]
[INFO] --- maven-site-plugin:3.4:attach-descriptor (attach-descriptor) @ plexus-compiler-javac ---
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Plexus Javac+error-prone Component 2.6-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ plexus-compiler-javac-errorprone ---
[INFO] Deleting /Users/montoyaedu/plexus-compiler/plexus-compilers/plexus-compiler-javac-errorprone/target
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ plexus-compiler-javac-errorprone ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /Users/montoyaedu/plexus-compiler/plexus-compilers/plexus-compiler-javac-errorprone/src/main/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ plexus-compiler-javac-errorprone ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to /Users/montoyaedu/plexus-compiler/plexus-compilers/plexus-compiler-javac-errorprone/target/classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /Users/montoyaedu/plexus-compiler/plexus-compilers/plexus-compiler-javac-errorprone/src/main/java/org/codehaus/plexus/compiler/javac/errorprone/JavacCompilerWithErrorProne.java:[122,32] cannot find symbol
symbol : method getClassLoadingLock(java.lang.String)
location: class org.codehaus.plexus.compiler.javac.errorprone.JavacCompilerWithErrorProne.NonDelegatingClassLoader
[ERROR] /Users/montoyaedu/plexus-compiler/plexus-compilers/plexus-compiler-javac-errorprone/src/main/java/org/codehaus/plexus/compiler/javac/errorprone/JavacCompilerWithErrorProne.java:[219,64] isOK() in com.sun.tools.javac.main.Main.Result is defined in an inaccessible class or interface
[INFO] 2 errors
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] Plexus Compiler ................................... SUCCESS [ 1.511 s]
[INFO] Plexus Compiler Api ............................... SUCCESS [ 2.547 s]
[INFO] Plexus Compiler Manager ........................... SUCCESS [ 0.803 s]
[INFO] Plexus Compiler Test Harness ...................... SUCCESS [ 0.363 s]
[INFO] Plexus Compilers .................................. SUCCESS [ 0.027 s]
[INFO] Plexus AspectJ Compiler ........................... SUCCESS [ 1.927 s]
[INFO] Plexus C# Compiler ................................ SUCCESS [ 0.721 s]
[INFO] Plexus Eclipse Compiler ........................... SUCCESS [ 1.709 s]
[INFO] Plexus Jikes Compiler ............................. SUCCESS [ 0.218 s]
[INFO] Plexus Javac Component ............................ SUCCESS [ 1.733 s]
[INFO] Plexus Javac+error-prone Component ................ FAILURE [ 0.093 s]
[INFO] Plexus J2ObjC Compiler ............................ SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 12.003 s
[INFO] Finished at: 2015-05-25T09:40:12+01:00
[INFO] Final Memory: 20M/81M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project plexus-compiler-javac-errorprone: Compilation failure: Compilation failure:
[ERROR] /Users/montoyaedu/plexus-compiler/plexus-compilers/plexus-compiler-javac-errorprone/src/main/java/org/codehaus/plexus/compiler/javac/errorprone/JavacCompilerWithErrorProne.java:[122,32] cannot find symbol
[ERROR] symbol : method getClassLoadingLock(java.lang.String)
[ERROR] location: class org.codehaus.plexus.compiler.javac.errorprone.JavacCompilerWithErrorProne.NonDelegatingClassLoader
[ERROR] /Users/montoyaedu/plexus-compiler/plexus-compilers/plexus-compiler-javac-errorprone/src/main/java/org/codehaus/plexus/compiler/javac/errorprone/JavacCompilerWithErrorProne.java:[219,64] isOK() in com.sun.tools.javac.main.Main.Result is defined in an inaccessible class or interface
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <goals> -rf :plexus-compiler-javac-errorprone
The JavacCompiler
class will not configure annotation processing if the source version is < 1.6, regardless of the JDK version in use. The impact to JDK 1.6+ systems which are configured to source version 1.5 is that JavacCompiler
will ignore the generated sources configurations and javac will process annotations using its default conventions.
In my environment, I am using Maven with JDK 1.8 and targeting Java 1.5 source. I would expect sources generated by annotation processors to be generated in the maven-compiler-plugin
default generated sources directory (${project.build.directory}/generated-sources/annotations
), but plexus-compiler never passes the -s flag to javac so the sources are instead generated in ${project.build.outputDirectory}
.
There's an update on http://openjdk.java.net/jeps/261 where the new arguments have been renamed to the GNU style convention
I am working on adding a showLint option to maven-compiler-plugin (https://issues.apache.org/jira/browse/MCOMPILER-442)
When I add a get/setShowLint() members to CompilerConfiguration the simple-javac test fails due to:
491:[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project simple-javac: Execution default-compile of goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile failed: An API incompatibility was encountered while executing org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile: java.lang.NoSuchMethodError: 'java.lang.String org.codehaus.plexus.compiler.CompilerConfiguration.getShowLint()'
493:[ERROR] realm = plugin>org.apache.maven.plugins:maven-compiler-plugin:3.8.1
495:[ERROR] urls[0] = file:/Users/mike/code/maven/plexus-compiler/plexus-compiler-its/target/local-repo/org/apache/maven/plugins/maven-compiler-plugin/3.8.1/maven-compiler-plugin-3.8.1.jar
As the 3.8.1 compiler does not know about this option. When build skipping tests and install the plexus-compiler API 3.8.9-SNAPSHOT and then build a maven compiler plugin 3.9.0-SNAPSHOT which uses the plexus-compiler API 3.8.9-SNAPSHOT I can execute the tests by using that version in plexus-compiler-its/src/main/it/simple-javac/pom.xml
but the circularity is problematic.
@olamy How can I introduce a new CompilerConfiguration without breaking the integration tests?
Since 2.8.6 it reads the files with default charset:
Try compiling the attached file when default charset is ISO-8859-1.
Utf.java.txt
The current way the Eclipse compiler adapter works prevents the use of a custom -log argument.
Trying to use plexus-compiler-eclipse 2.9.0 with maven-compiler-plugin 3.8.1 leads to
org.apache.maven.plugin.PluginContainerException: An API incompatibility was encountered while executing org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile: java.lang.NoSuchMethodError: 'java.lang.String org.codehaus.plexus.compiler.CompilerConfiguration.getWarnings()'
with stack trace
Caused by: java.lang.NoSuchMethodError: 'java.lang.String org.codehaus.plexus.compiler.CompilerConfiguration.getWarnings()'
15:24:41 at org.codehaus.plexus.compiler.eclipse.EclipseJavaCompiler.performCompile (EclipseJavaCompiler.java:132)
15:24:41 at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute (AbstractCompilerMojo.java:1134)
15:24:41 at org.apache.maven.plugin.compiler.CompilerMojo.execute (CompilerMojo.java:187)
and reports
15:24:41 [ERROR] urls[1] = file:.../.repository/org/codehaus/plexus/plexus-compiler-eclipse/2.9.0/plexus-compiler-eclipse-2.9.0.jar
...
15:24:41 [ERROR] urls[17] = file:.../.repository/org/codehaus/plexus/plexus-compiler-api/2.8.4/plexus-compiler-api-2.8.4.jar
15:24:41 [ERROR] urls[18] = file:.../.repository/org/codehaus/plexus/plexus-compiler-manager/2.8.4/plexus-compiler-manager-2.8.4.jar
15:24:41 [ERROR] urls[19] = file:.../.repository/org/codehaus/plexus/plexus-compiler-javac/2.8.4/plexus-compiler-javac-2.8.4.jar
plexus-compiler-eclipse 2.9.0 depends on plexus-compiler-api 2.9.0, but doesn't declare this dependency in the pom.xml. So one ends up with inconsistent versions.
Users would have to override the maven-compiler-plugin config by not only adding the dependency to plexus-compiler-eclipse:2.9.0 but also to plexus-compiler-api:2.9.0.
I think the dependency should be declared.
Recently the support of -parameters
was added and the idea is that it should just ignore the parameter when running on a pre Java8 runtime.
It looks like the assertion can be improved as a build with Java7 fails if the parameters
flag is provided. I guess it's related with the fact that the source and version have been (wrongly) set on 1.8 on a JDK7 runtime. Is there a way to check we're running with a JDK7 compiler?
-target 1.8
will fail with a more explicit exception but because we set an invalid flag we don't have the chance to reach that point :(
See spring-projects/spring-boot#10082 (comment)
Full log for the plugin
[DEBUG] Configuring mojo 'org.apache.maven.plugins:maven-compiler-plugin:3.6.2:compile' with basic configurator -->
[DEBUG] (f) basedir = /Users/bclozel/workspace/spring-boot/spring-boot-samples/spring-boot-sample-tomcat
[DEBUG] (f) buildDirectory = /Users/bclozel/workspace/spring-boot/spring-boot-samples/spring-boot-sample-tomcat/target
[DEBUG] (f) compilePath = [/Users/bclozel/workspace/spring-boot/spring-boot-samples/spring-boot-sample-tomcat/target/classes, /Users/bclozel/.m2/repository/org/springframework/boot/spring-boot-starter/2.0.0.BUILD-SNAPSHOT/spring-boot-starter-2.0.0.BUILD-SNAPSHOT.jar, /Users/bclozel/.m2/repository/org/springframework/boot/spring-boot/2.0.0.BUILD-SNAPSHOT/spring-boot-2.0.0.BUILD-SNAPSHOT.jar, /Users/bclozel/.m2/repository/org/springframework/boot/spring-boot-autoconfigure/2.0.0.BUILD-SNAPSHOT/spring-boot-autoconfigure-2.0.0.BUILD-SNAPSHOT.jar, /Users/bclozel/.m2/repository/org/springframework/boot/spring-boot-starter-logging/2.0.0.BUILD-SNAPSHOT/spring-boot-starter-logging-2.0.0.BUILD-SNAPSHOT.jar, /Users/bclozel/.m2/repository/ch/qos/logback/logback-classic/1.2.3/logback-classic-1.2.3.jar, /Users/bclozel/.m2/repository/ch/qos/logback/logback-core/1.2.3/logback-core-1.2.3.jar, /Users/bclozel/.m2/repository/org/slf4j/jul-to-slf4j/1.7.25/jul-to-slf4j-1.7.25.jar, /Users/bclozel/.m2/repository/org/slf4j/log4j-over-slf4j/1.7.25/log4j-over-slf4j-1.7.25.jar, /Users/bclozel/.m2/repository/org/springframework/spring-core/5.0.0.RC3/spring-core-5.0.0.RC3.jar, /Users/bclozel/.m2/repository/org/springframework/spring-jcl/5.0.0.RC3/spring-jcl-5.0.0.RC3.jar, /Users/bclozel/.m2/repository/org/springframework/boot/spring-boot-starter-tomcat/2.0.0.BUILD-SNAPSHOT/spring-boot-starter-tomcat-2.0.0.BUILD-SNAPSHOT.jar, /Users/bclozel/.m2/repository/org/apache/tomcat/embed/tomcat-embed-core/8.5.16/tomcat-embed-core-8.5.16.jar, /Users/bclozel/.m2/repository/org/apache/tomcat/embed/tomcat-embed-el/8.5.16/tomcat-embed-el-8.5.16.jar, /Users/bclozel/.m2/repository/org/apache/tomcat/embed/tomcat-embed-websocket/8.5.16/tomcat-embed-websocket-8.5.16.jar, /Users/bclozel/.m2/repository/org/springframework/spring-webmvc/5.0.0.RC3/spring-webmvc-5.0.0.RC3.jar, /Users/bclozel/.m2/repository/org/springframework/spring-aop/5.0.0.RC3/spring-aop-5.0.0.RC3.jar, /Users/bclozel/.m2/repository/org/springframework/spring-beans/5.0.0.RC3/spring-beans-5.0.0.RC3.jar, /Users/bclozel/.m2/repository/org/springframework/spring-context/5.0.0.RC3/spring-context-5.0.0.RC3.jar, /Users/bclozel/.m2/repository/org/springframework/spring-expression/5.0.0.RC3/spring-expression-5.0.0.RC3.jar, /Users/bclozel/.m2/repository/org/springframework/spring-web/5.0.0.RC3/spring-web-5.0.0.RC3.jar, /Users/bclozel/.m2/repository/org/slf4j/slf4j-api/1.7.25/slf4j-api-1.7.25.jar]
[DEBUG] (f) compileSourceRoots = [/Users/bclozel/workspace/spring-boot/spring-boot-samples/spring-boot-sample-tomcat/src/main/java]
[DEBUG] (f) compilerId = javac
[DEBUG] (f) debug = true
[DEBUG] (f) encoding = UTF-8
[DEBUG] (f) failOnError = true
[DEBUG] (f) failOnWarning = false
[DEBUG] (f) forceJavacCompilerUse = false
[DEBUG] (f) fork = false
[DEBUG] (f) generatedSourcesDirectory = /Users/bclozel/workspace/spring-boot/spring-boot-samples/spring-boot-sample-tomcat/target/generated-sources/annotations
[DEBUG] (f) mojoExecution = org.apache.maven.plugins:maven-compiler-plugin:3.6.2:compile {execution: default-compile}
[DEBUG] (f) optimize = false
[DEBUG] (f) outputDirectory = /Users/bclozel/workspace/spring-boot/spring-boot-samples/spring-boot-sample-tomcat/target/classes
[DEBUG] (f) parameters = true
[DEBUG] (f) project = MavenProject: org.springframework.boot:spring-boot-sample-tomcat:2.0.0.BUILD-SNAPSHOT @ /Users/bclozel/workspace/spring-boot/spring-boot-samples/spring-boot-sample-tomcat/pom.xml
[DEBUG] (f) projectArtifact = org.springframework.boot:spring-boot-sample-tomcat:jar:2.0.0.BUILD-SNAPSHOT
[DEBUG] (f) session = org.apache.maven.execution.MavenSession@b2d2e71
[DEBUG] (f) showDeprecation = false
[DEBUG] (f) showWarnings = false
[DEBUG] (f) skipMultiThreadWarning = false
[DEBUG] (f) source = 1.8
[DEBUG] (f) staleMillis = 0
[DEBUG] (f) target = 1.8
[DEBUG] (f) useIncrementalCompilation = true
[DEBUG] (f) verbose = false
[DEBUG] -- end configuration --
[DEBUG] Using compiler 'javac'.
[DEBUG] Adding /Users/bclozel/workspace/spring-boot/spring-boot-samples/spring-boot-sample-tomcat/target/generated-sources/annotations to compile source roots:
/Users/bclozel/workspace/spring-boot/spring-boot-samples/spring-boot-sample-tomcat/src/main/java
[DEBUG] New compile source roots:
/Users/bclozel/workspace/spring-boot/spring-boot-samples/spring-boot-sample-tomcat/src/main/java
/Users/bclozel/workspace/spring-boot/spring-boot-samples/spring-boot-sample-tomcat/target/generated-sources/annotations
[DEBUG] CompilerReuseStrategy: reuseCreated
[DEBUG] useIncrementalCompilation enabled
[DEBUG] Stale source detected: /Users/bclozel/workspace/spring-boot/spring-boot-samples/spring-boot-sample-tomcat/src/main/java/sample/tomcat/web/SampleController.java
[DEBUG] Stale source detected: /Users/bclozel/workspace/spring-boot/spring-boot-samples/spring-boot-sample-tomcat/src/main/java/sample/tomcat/service/HelloWorldService.java
[DEBUG] Stale source detected: /Users/bclozel/workspace/spring-boot/spring-boot-samples/spring-boot-sample-tomcat/src/main/java/sample/tomcat/SampleTomcatApplication.java
[INFO] Changes detected - recompiling the module!
[DEBUG] Classpath:
[DEBUG] /Users/bclozel/workspace/spring-boot/spring-boot-samples/spring-boot-sample-tomcat/target/classes
[DEBUG] /Users/bclozel/.m2/repository/org/springframework/boot/spring-boot-starter/2.0.0.BUILD-SNAPSHOT/spring-boot-starter-2.0.0.BUILD-SNAPSHOT.jar
[DEBUG] /Users/bclozel/.m2/repository/org/springframework/boot/spring-boot/2.0.0.BUILD-SNAPSHOT/spring-boot-2.0.0.BUILD-SNAPSHOT.jar
[DEBUG] /Users/bclozel/.m2/repository/org/springframework/boot/spring-boot-autoconfigure/2.0.0.BUILD-SNAPSHOT/spring-boot-autoconfigure-2.0.0.BUILD-SNAPSHOT.jar
[DEBUG] /Users/bclozel/.m2/repository/org/springframework/boot/spring-boot-starter-logging/2.0.0.BUILD-SNAPSHOT/spring-boot-starter-logging-2.0.0.BUILD-SNAPSHOT.jar
[DEBUG] /Users/bclozel/.m2/repository/ch/qos/logback/logback-classic/1.2.3/logback-classic-1.2.3.jar
[DEBUG] /Users/bclozel/.m2/repository/ch/qos/logback/logback-core/1.2.3/logback-core-1.2.3.jar
[DEBUG] /Users/bclozel/.m2/repository/org/slf4j/jul-to-slf4j/1.7.25/jul-to-slf4j-1.7.25.jar
[DEBUG] /Users/bclozel/.m2/repository/org/slf4j/log4j-over-slf4j/1.7.25/log4j-over-slf4j-1.7.25.jar
[DEBUG] /Users/bclozel/.m2/repository/org/springframework/spring-core/5.0.0.RC3/spring-core-5.0.0.RC3.jar
[DEBUG] /Users/bclozel/.m2/repository/org/springframework/spring-jcl/5.0.0.RC3/spring-jcl-5.0.0.RC3.jar
[DEBUG] /Users/bclozel/.m2/repository/org/springframework/boot/spring-boot-starter-tomcat/2.0.0.BUILD-SNAPSHOT/spring-boot-starter-tomcat-2.0.0.BUILD-SNAPSHOT.jar
[DEBUG] /Users/bclozel/.m2/repository/org/apache/tomcat/embed/tomcat-embed-core/8.5.16/tomcat-embed-core-8.5.16.jar
[DEBUG] /Users/bclozel/.m2/repository/org/apache/tomcat/embed/tomcat-embed-el/8.5.16/tomcat-embed-el-8.5.16.jar
[DEBUG] /Users/bclozel/.m2/repository/org/apache/tomcat/embed/tomcat-embed-websocket/8.5.16/tomcat-embed-websocket-8.5.16.jar
[DEBUG] /Users/bclozel/.m2/repository/org/springframework/spring-webmvc/5.0.0.RC3/spring-webmvc-5.0.0.RC3.jar
[DEBUG] /Users/bclozel/.m2/repository/org/springframework/spring-aop/5.0.0.RC3/spring-aop-5.0.0.RC3.jar
[DEBUG] /Users/bclozel/.m2/repository/org/springframework/spring-beans/5.0.0.RC3/spring-beans-5.0.0.RC3.jar
[DEBUG] /Users/bclozel/.m2/repository/org/springframework/spring-context/5.0.0.RC3/spring-context-5.0.0.RC3.jar
[DEBUG] /Users/bclozel/.m2/repository/org/springframework/spring-expression/5.0.0.RC3/spring-expression-5.0.0.RC3.jar
[DEBUG] /Users/bclozel/.m2/repository/org/springframework/spring-web/5.0.0.RC3/spring-web-5.0.0.RC3.jar
[DEBUG] /Users/bclozel/.m2/repository/org/slf4j/slf4j-api/1.7.25/slf4j-api-1.7.25.jar
[DEBUG] Source roots:
[DEBUG] /Users/bclozel/workspace/spring-boot/spring-boot-samples/spring-boot-sample-tomcat/src/main/java
[DEBUG] /Users/bclozel/workspace/spring-boot/spring-boot-samples/spring-boot-sample-tomcat/target/generated-sources/annotations
[DEBUG] Command line options:
[DEBUG] -d /Users/bclozel/workspace/spring-boot/spring-boot-samples/spring-boot-sample-tomcat/target/classes -classpath /Users/bclozel/workspace/spring-boot/spring-boot-samples/spring-boot-sample-tomcat/target/classes:/Users/bclozel/.m2/repository/org/springframework/boot/spring-boot-starter/2.0.0.BUILD-SNAPSHOT/spring-boot-starter-2.0.0.BUILD-SNAPSHOT.jar:/Users/bclozel/.m2/repository/org/springframework/boot/spring-boot/2.0.0.BUILD-SNAPSHOT/spring-boot-2.0.0.BUILD-SNAPSHOT.jar:/Users/bclozel/.m2/repository/org/springframework/boot/spring-boot-autoconfigure/2.0.0.BUILD-SNAPSHOT/spring-boot-autoconfigure-2.0.0.BUILD-SNAPSHOT.jar:/Users/bclozel/.m2/repository/org/springframework/boot/spring-boot-starter-logging/2.0.0.BUILD-SNAPSHOT/spring-boot-starter-logging-2.0.0.BUILD-SNAPSHOT.jar:/Users/bclozel/.m2/repository/ch/qos/logback/logback-classic/1.2.3/logback-classic-1.2.3.jar:/Users/bclozel/.m2/repository/ch/qos/logback/logback-core/1.2.3/logback-core-1.2.3.jar:/Users/bclozel/.m2/repository/org/slf4j/jul-to-slf4j/1.7.25/jul-to-slf4j-1.7.25.jar:/Users/bclozel/.m2/repository/org/slf4j/log4j-over-slf4j/1.7.25/log4j-over-slf4j-1.7.25.jar:/Users/bclozel/.m2/repository/org/springframework/spring-core/5.0.0.RC3/spring-core-5.0.0.RC3.jar:/Users/bclozel/.m2/repository/org/springframework/spring-jcl/5.0.0.RC3/spring-jcl-5.0.0.RC3.jar:/Users/bclozel/.m2/repository/org/springframework/boot/spring-boot-starter-tomcat/2.0.0.BUILD-SNAPSHOT/spring-boot-starter-tomcat-2.0.0.BUILD-SNAPSHOT.jar:/Users/bclozel/.m2/repository/org/apache/tomcat/embed/tomcat-embed-core/8.5.16/tomcat-embed-core-8.5.16.jar:/Users/bclozel/.m2/repository/org/apache/tomcat/embed/tomcat-embed-el/8.5.16/tomcat-embed-el-8.5.16.jar:/Users/bclozel/.m2/repository/org/apache/tomcat/embed/tomcat-embed-websocket/8.5.16/tomcat-embed-websocket-8.5.16.jar:/Users/bclozel/.m2/repository/org/springframework/spring-webmvc/5.0.0.RC3/spring-webmvc-5.0.0.RC3.jar:/Users/bclozel/.m2/repository/org/springframework/spring-aop/5.0.0.RC3/spring-aop-5.0.0.RC3.jar:/Users/bclozel/.m2/repository/org/springframework/spring-beans/5.0.0.RC3/spring-beans-5.0.0.RC3.jar:/Users/bclozel/.m2/repository/org/springframework/spring-context/5.0.0.RC3/spring-context-5.0.0.RC3.jar:/Users/bclozel/.m2/repository/org/springframework/spring-expression/5.0.0.RC3/spring-expression-5.0.0.RC3.jar:/Users/bclozel/.m2/repository/org/springframework/spring-web/5.0.0.RC3/spring-web-5.0.0.RC3.jar:/Users/bclozel/.m2/repository/org/slf4j/slf4j-api/1.7.25/slf4j-api-1.7.25.jar: -sourcepath /Users/bclozel/workspace/spring-boot/spring-boot-samples/spring-boot-sample-tomcat/src/main/java:/Users/bclozel/workspace/spring-boot/spring-boot-samples/spring-boot-sample-tomcat/target/generated-sources/annotations: -s /Users/bclozel/workspace/spring-boot/spring-boot-samples/spring-boot-sample-tomcat/target/generated-sources/annotations -g -parameters -nowarn -target 1.8 -source 1.8 -encoding UTF-8
[DEBUG] incrementalBuildHelper#beforeRebuildExecution
[INFO] Compiling 3 source files to /Users/bclozel/workspace/spring-boot/spring-boot-samples/spring-boot-sample-tomcat/target/classes
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.594 s
[INFO] Finished at: 2017-08-28T16:21:17+02:00
[INFO] Final Memory: 19M/310M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.6.2:compile (default-compile) on project spring-boot-sample-tomcat: Fatal error compiling: invalid flag: -parameters -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.6.2:compile (default-compile) on project spring-boot-sample-tomcat: Fatal error compiling
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:213)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:154)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:146)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:309)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:194)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:107)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:993)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:345)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:191)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoExecutionException: Fatal error compiling
at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:963)
at org.apache.maven.plugin.compiler.CompilerMojo.execute(CompilerMojo.java:158)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
... 20 more
Caused by: org.codehaus.plexus.compiler.CompilerException: invalid flag: -parameters
at org.codehaus.plexus.compiler.javac.JavaxToolsCompiler.compileInProcess(JavaxToolsCompiler.java:173)
at org.codehaus.plexus.compiler.javac.JavacCompiler.performCompile(JavacCompiler.java:174)
at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:952)
... 23 more
Caused by: java.lang.IllegalArgumentException: invalid flag: -parameters
at com.sun.tools.javac.api.JavacTool.processOptions(JavacTool.java:231)
at com.sun.tools.javac.api.JavacTool.getTask(JavacTool.java:199)
at com.sun.tools.javac.api.JavacTool.getTask(JavacTool.java:68)
at org.codehaus.plexus.compiler.javac.JavaxToolsCompiler.compileInProcess(JavaxToolsCompiler.java:125)
... 25 more
This is triggered by the Stack Overflow question No verbose output when fork option is used for maven-compiler-plugin.
The JavacCompiler
is ignoring the standard output of the javac executable (thus ignoring the verbose configuration) when used in forked mode.
This is because in the method compileOutOfProcess
, the CommandLineUtils.StringStreamConsumer out
variable populated with the standard output is ignored when populating the resulting messages:
returnCode = CommandLineUtils.executeCommandLine( cli, out, err );
messages = parseModernStream( returnCode, new BufferedReader( new StringReader( err.getOutput() ) ) );
As suggested fix, the parseModernStream
method should take both the result of the error output and standard output.
While trying out Error Prone, the compilation failed because one of our other annotation processors required an extra jar on the classpath. JavacCompiler.parseModernStream
ignores annotation processor exceptions, making it very hard to figure out what went wrong.
This is the forked Javac's output:
/home/dan/Work/infinispan/commons/all/src/main/java/org/infinispan/commons/dataconversion/MediaType.java:20: warning: [deprecation] Externalizer in org.infinispan.commons.marshall has been deprecated
import org.infinispan.commons.marshall.Externalizer;
^
/home/dan/Work/infinispan/commons/all/src/main/java/org/infinispan/commons/dataconversion/MediaType.java:22: warning: [deprecation] SerializeWith in org.infinispan.commons.marshall has been deprecated
import org.infinispan.commons.marshall.SerializeWith;
^
/home/dan/Work/infinispan/commons/all/src/main/java/org/infinispan/commons/tx/XidImpl.java:13: warning: [deprecation] AdvancedExternalizer in org.infinispan.commons.marshall has been deprecated
import org.infinispan.commons.marshall.AdvancedExternalizer;
^
/home/dan/Work/infinispan/commons/all/src/main/java/org/infinispan/commons/dataconversion/MarshallerEncoder.java:7: warning: [deprecation] StreamingMarshaller in org.infinispan.commons.marshall has been deprecated
import org.infinispan.commons.marshall.StreamingMarshaller;
^
/home/dan/Work/infinispan/commons/all/src/main/java/org/infinispan/commons/util/ImmutableListCopy.java:15: warning: [deprecation] AdvancedExternalizer in org.infinispan.commons.marshall has been deprecated
import org.infinispan.commons.marshall.AdvancedExternalizer;
^
Note: Writing META-INF/services/reactor.blockhound.integration.BlockHoundIntegration
5 warnings
An annotation processor threw an uncaught exception.
Consult the following stack trace for details.
java.lang.NoClassDefFoundError: javax/annotation/Generated
at org.infinispan.protostream.annotations.impl.processor.AutoProtoSchemaBuilderAnnotationProcessor.addGeneratedClassHeader(AutoProtoSchemaBuilderAnnotationProcessor.java:565)
at org.infinispan.protostream.annotations.impl.processor.MarshallerSourceCodeGenerator.generateMessageMarshaller(MarshallerSourceCodeGenerator.java:156)
at org.infinispan.protostream.annotations.impl.processor.MarshallerSourceCodeGenerator.generateMarshaller(MarshallerSourceCodeGenerator.java:56)
at org.infinispan.protostream.annotations.impl.BaseProtoSchemaGenerator.generateMarshallers(BaseProtoSchemaGenerator.java:204)
at org.infinispan.protostream.annotations.impl.BaseProtoSchemaGenerator.generateAndRegister(BaseProtoSchemaGenerator.java:175)
at org.infinispan.protostream.annotations.impl.processor.AutoProtoSchemaBuilderAnnotationProcessor.processClass(AutoProtoSchemaBuilderAnnotationProcessor.java:321)
at org.infinispan.protostream.annotations.impl.processor.AutoProtoSchemaBuilderAnnotationProcessor.processElement(AutoProtoSchemaBuilderAnnotationProcessor.java:252)
at org.infinispan.protostream.annotations.impl.processor.AutoProtoSchemaBuilderAnnotationProcessor.process(AutoProtoSchemaBuilderAnnotationProcessor.java:179)
at jdk.compiler/com.sun.tools.javac.processing.JavacProcessingEnvironment.callProcessor(JavacProcessingEnvironment.java:1026)
at jdk.compiler/com.sun.tools.javac.processing.JavacProcessingEnvironment.discoverAndRunProcs(JavacProcessingEnvironment.java:941)
at jdk.compiler/com.sun.tools.javac.processing.JavacProcessingEnvironment$Round.run(JavacProcessingEnvironment.java:1270)
at jdk.compiler/com.sun.tools.javac.processing.JavacProcessingEnvironment.doProcessing(JavacProcessingEnvironment.java:1384)
at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.processAnnotations(JavaCompiler.java:1263)
at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:935)
at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:316)
at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:176)
at jdk.compiler/com.sun.tools.javac.Main.compile(Main.java:57)
at jdk.compiler/com.sun.tools.javac.Main.main(Main.java:43)
Caused by: java.lang.ClassNotFoundException: javax.annotation.Generated
at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:435)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:589)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
... 18 more
And this is the parsed list of messages:
messages = {java.util.ArrayList} size = 5
0 = {org.codehaus.plexus.compiler.CompilerMessage} "/home/dan/Work/infinispan/commons/all/src/main/java/org/infinispan/commons/dataconversion/MediaType.java:[20,38] [deprecation] Externalizer in org.infinispan.commons.marshall has been deprecated"
1 = {org.codehaus.plexus.compiler.CompilerMessage} "/home/dan/Work/infinispan/commons/all/src/main/java/org/infinispan/commons/dataconversion/MediaType.java:[22,38] [deprecation] SerializeWith in org.infinispan.commons.marshall has been deprecated"
2 = {org.codehaus.plexus.compiler.CompilerMessage} "/home/dan/Work/infinispan/commons/all/src/main/java/org/infinispan/commons/tx/XidImpl.java:[13,38] [deprecation] AdvancedExternalizer in org.infinispan.commons.marshall has been deprecated"
3 = {org.codehaus.plexus.compiler.CompilerMessage} "/home/dan/Work/infinispan/commons/all/src/main/java/org/infinispan/commons/dataconversion/MarshallerEncoder.java:[7,38] [deprecation] StreamingMarshaller in org.infinispan.commons.marshall has been deprecated"
4 = {org.codehaus.plexus.compiler.CompilerMessage} "/home/dan/Work/infinispan/commons/all/src/main/java/org/infinispan/commons/util/ImmutableListCopy.java:[15,38] [deprecation] AdvancedExternalizer in org.infinispan.commons.marshall has been deprecated"
The compile uses the deprecated class which has been removed in 2.4.0, see commit google/error-prone@9eb414c#diff-c3084f6c295b5e983dc0963a0bec19a1
Caused by: java.lang.ClassNotFoundException: com.google.errorprone.ErrorProneCompiler
at java.net.URLClassLoader.findClass (URLClassLoader.java:382)
at java.lang.ClassLoader.loadClass (ClassLoader.java:418)
at org.codehaus.plexus.compiler.javac.errorprone.JavacCompilerWithErrorProne$NonDelegatingClassLoader.loadClass (JavacCompilerWithErrorProne.java:138)
at java.lang.ClassLoader.loadClass (ClassLoader.java:351)
at org.codehaus.plexus.compiler.javac.errorprone.JavacCompilerWithErrorProne$CompilerInvoker.compile (JavacCompilerWithErrorProne.java:220)
at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:498)
at org.codehaus.plexus.compiler.javac.errorprone.JavacCompilerWithErrorProne.performCompile (JavacCompilerWithErrorProne.java:91)
at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute (AbstractCompilerMojo.java:1134)
at org.apache.maven.plugin.compiler.CompilerMojo.execute (CompilerMojo.java:187)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:498)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
The following config was used:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<compilerId>javac-with-errorprone</compilerId>
<forceJavacCompilerUse>true</forceJavacCompilerUse>
<fork>true</fork>
<source>8</source>
<target>8</target>
<showWarnings>true</showWarnings>
<showDeprecation>true</showDeprecation>
<encoding>UTF-8</encoding>
<compilerArgs>
<compilerArg>-XepDisableWarningsInGeneratedCode</compilerArg>
<compilerArg>-XepExcludedPaths:.*/target/.*</compilerArg>
<compilerArg>-Xep:WildcardImport:ERROR</compilerArg>
<compilerArg>-Xep:RemoveUnusedImports:ERROR</compilerArg>
<compilerArg>-Xep:DeadException:ERROR</compilerArg>
</compilerArgs>
</configuration>
<dependencies>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-compiler-javac-errorprone</artifactId>
<version>2.8.6</version>
</dependency>
<dependency>
<groupId>com.google.errorprone</groupId>
<artifactId>error_prone_core</artifactId>
<version>2.4.0</version>
</dependency>
</dependencies>
</plugin>
When debug logging is turned on Javac Plexus compiler creates two additional files in target/classes
or target/test-classes
. These files will be also included in the built artifact, say a JAR file.
This is done here:
And here:
Seems that the calls to config.getOutputLocation()
need to be replaced with config.getBuildDirectory()
in those two instances.
Hi
It seems that org.codehaus.plexus:plexus-compiler-csharp:2.8.7
is buggy while
org.codehaus.plexus:plexus-compiler-csharp:2.8.6
is fine.
See 2.8.6.log versus 2.8.7.log
For implementing Maven issue MNG-4660 we would like to be able to know when the last compilation happened. We need this information to determine the packaged artifact (.jar) is up-to-date with the compiled sources (in target/classes usually).
For now we will look through all target/classes files to check their lastModified time, but if we could use the lastModified time on the target/classes directory, we could improve performance a lot.
On Unix based systems, the target/classes directory will (if I remember correctly) be updated to the time of compilation, but for Windows it isn't.
https://stackoverflow.com/questions/12249155/how-to-get-the-last-modified-date-and-time-of-a-directory-in-java
So my suggestion is to overwrite the lastModified property on the target/classes directory after compilation.
Starting with Java 7, the Oracle version of javac
(probably also applies to OpenJDK, etc.) places the "symbol" and "location" lines after the line terminating in the ^
character. As a result, the parsing logic in JavacCompiler
discards potentially important compiler output for the last message that is printed (messages printed prior to the last one have the previous message's extra context prepended to their own message).
Examples:
Java 6 javac
:
Error.java:3: cannot find symbol
symbol : class Properties
location: class Error
Properties p = new Properties();
^
Error.java:3: cannot find symbol
symbol : class Properties
location: class Error
Properties p = new Properties();
^
2 errors
Java 7 javac
:
Error.java:3: error: cannot find symbol
Properties p = new Properties();
^
symbol: class Properties
location: class Error
Error.java:3: error: cannot find symbol
Properties p = new Properties();
^
symbol: class Properties
location: class Error
2 errors
Java 7 plexus-compiler-javac
:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.3:compile (default-compile) on project test: Compilation failure: Compilation failure:
[ERROR] Error.java:[3,2] error: cannot find symbol
[ERROR] symbol: class Properties
[ERROR] location: class Error
[ERROR] Error.java:[3,21] error: cannot find symbol
[ERROR] -> [Help 1]
Note the missing context for the last error.
I had a Java class using a builder pattern to put together a lookup table. There was another class which chained together 600+ method calls on a single line on this builder, assembling the table. Understandably, as the number of entries in the lookup table grew, we eventually ran into a StackOverflowError
from javac
while compiling the class. javac
does not handle this gracefully; the SOE stacktrace is written to stderr with no surrounding context clues, and then the compiler exits.
The project is built using Maven, which of course uses plexus-compiler-javac
. We run the build in forked mode.
Unfortunately, the Plexus compiler recognizes the forked build as failed, but does not capture the cause. There are no messages on the CompilerResult
, and nothing is printed to stdout/stderr. It was therefore quite difficult for me to diagnose the cause of the compilation failure. By enabling verbose mode, I was able to see the compiler's progress, and through process of elimination I identified the problematic class. One look at the class led me to suspect an SOE, which I was able to verify by compiling the class manually at the command line. From there, it was a simple matter of splitting up the line of code into multiple lines.
I have created an MVCE here: https://github.com/jakerobb/plexus-javac-compiler-bug. It's a small Maven project. Just clone it and run mvn test
to reproduce the issue.
I think that #39 would have been helpful here, but I also think that some other improvements are called for:
Of course, ideally, javac should be fixed to not throw an SOE in this scenario, probably by replacing recursion with iteration, and also to write out the file it was working on when compilation fails. I'm now off to figure out how to report an improvement request in javac....
See Eclipse bug 559645 for context and a sample Eclipse maven project showing the issue.
Basically, ECJ reports these diagnostics from APT processors as "extra_problem" elements in the log XML. plexus-compiler-eclipse completely ignores these when parsing the XML to get the diagnostics. Even if it did parse them, ECJ at least up to 3.20.0 has a bug and doesn't report the source file for these extra_problems in the XML, so the output would not be really helpful.
The following output results in no messages at all:
warning: [path] bad path element "d:\maven_repo\.m2\repository\org\ow2\asm\asm-xml\5.0.3\asm-5.0.3.jar": no such file or directory
warning: [path] bad path element "d:\maven_repo\.m2\repository\org\ow2\asm\asm-xml\5.0.3\asm-util-5.0.3.jar": no such file or directory
warning: [options] bootstrap class path not set in conjunction with -source 1.7
3 warnings
An exception has occurred in the compiler (9). Please file a bug against the Java compiler via the Java bug reporting page (http://bugreport.java.com) after checking the Bug Database (http://bugs.java.com) for duplicates. Include your program and the following diagnostic in your report. Thank you.
java.lang.NullPointerException
at jdk.zipfs/jdk.nio.zipfs.JarFileSystem.getVersionMap(JarFileSystem.java:137)
at jdk.zipfs/jdk.nio.zipfs.JarFileSystem.createVersionedLinks(JarFileSystem.java:112)
at jdk.zipfs/jdk.nio.zipfs.JarFileSystem.<init>(JarFileSystem.java:85)
at jdk.zipfs/jdk.nio.zipfs.ZipFileSystemProvider.newFileSystem(ZipFileSystemProvider.java:134)
at jdk.compiler/com.sun.tools.javac.file.JavacFileManager$ArchiveContainer.<init>(JavacFileManager.java:517)
at jdk.compiler/com.sun.tools.javac.file.JavacFileManager.getContainer(JavacFileManager.java:319)
at jdk.compiler/com.sun.tools.javac.file.JavacFileManager.list(JavacFileManager.java:715)
at jdk.compiler/com.sun.tools.javac.code.ClassFinder.list(ClassFinder.java:722)
at jdk.compiler/com.sun.tools.javac.code.ClassFinder.scanUserPaths(ClassFinder.java:655)
at jdk.compiler/com.sun.tools.javac.code.ClassFinder.fillIn(ClassFinder.java:526)
at jdk.compiler/com.sun.tools.javac.code.ClassFinder.complete(ClassFinder.java:293)
at jdk.compiler/com.sun.tools.javac.code.Symbol.complete(Symbol.java:633)
at jdk.compiler/com.sun.tools.javac.code.Symbol$PackageSymbol.members(Symbol.java:1120)
at jdk.compiler/com.sun.tools.javac.code.Symtab.listPackageModules(Symtab.java:810)
at jdk.compiler/com.sun.tools.javac.comp.Enter.visitTopLevel(Enter.java:344)
at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCCompilationUnit.accept(JCTree.java:529)
at jdk.compiler/com.sun.tools.javac.comp.Enter.classEnter(Enter.java:285)
at jdk.compiler/com.sun.tools.javac.comp.Enter.classEnter(Enter.java:300)
at jdk.compiler/com.sun.tools.javac.comp.Enter.complete(Enter.java:570)
at jdk.compiler/com.sun.tools.javac.comp.Enter.main(Enter.java:554)
at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.enterTrees(JavaCompiler.java:1052)
at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:923)
at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:302)
at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:162)
at jdk.compiler/com.sun.tools.javac.Main.compile(Main.java:57)
at jdk.compiler/com.sun.tools.javac.Main.main(Main.java:43)
Hello,
The following project is configured for compiling into a .NET executable, but it is not working properly since it always generates a dll.
https://github.com/ethiclab/example-csharp-maven-project-01
We have been working on a fix, please let us know if we can issue a pull request.
Our latest commit is:
https://github.com/ethiclab/plexus-compiler/tree/feature/fix-compiler-args
Thanks in advance,
Best,
EthicLab.
Originally reported at https://issues.apache.org/jira/browse/MCOMPILER-279
I need somehow to set --no-package-directories
flag, but can't find how to do that with plugin definition.
Provided example of
<compilerArguments>
<use-arc />
<sourcepath>src/main/java</sourcepath>
</compilerArguments>
doesn't allow it because of --
(double minus sign)
Using of
<compilerArgs>
<arg>-use-arc</arg>
<arg>-sourcepath src/main/java</arg>
<arg>-d target/objc</arg>
<arg>-x objective-c</arg>
<arg>--no-package-directories</arg>
</compilerArgs>
fails with The argument -sourcepath src/main/java isnt't a flag recognized by J2ObjC.
Hi,
I experienced a problem with mulitple --add-exports during my Maven build and created an issue in the Maven compiler plugin (see https://issues.apache.org/jira/browse/MCOMPILER-279).
Since the plugin works with the normal Java compiler and also the Eclipse compiler itself understands multiple add-exports arguments, he pointed me to the EclipseJavaCompiler here.
The problem is that in line https://github.com/codehaus-plexus/plexus-compiler/blob/master/plexus-compilers/plexus-compiler-eclipse/src/main/java/org/codehaus/plexus/compiler/eclipse/EclipseJavaCompiler.java#L179, the custom compiler arguments are processed as entries of a map. But here, the entries should be processed as real entry pairs. Therefore the method config.getCustomCompilerArgumentsEntries() should be used. But there is also a failing test thus a further change becomes necessary. Thus the change for line #179 would be following:
for ( Entry<String, String> entry : config.getCustomCompilerArgumentsEntries() )
{
// omit errorsAsWarnings options which already have been handled above
if ( entry.getKey().equals("errorsAsWarnings") || entry.getKey().equals("-errorsAsWarnings") )
{
continue;
}
I don't know exactly how to provide a patch or a pull request and I'm totally unsure of how to provide a unit test verifying the correct behaviour after the fix. I had a look at the existing unit tests but didn't find anything I could really base a new test case upon.
But I would give a PR a try if someone can point me to a howto, etc....
During parseMordemStream
, with exitCode=4
, the following message is skipped:
An exception has occurred in the compiler (1.7.0_80). Please file a bug at the Java Developer Connection (http://java.sun.com/webapps/bugreport) after checking the Bug Parade for duplicates. Include your program and the following diagnostic in your report. Thank you.
com.sun.tools.javac.code.Symbol$CompletionFailure: class file for java.util.Optional not found
As the buffer doesn't match the condition, the message will never be added in the errors
list.
What is the purpose/idea/reason for that?
Maven builds fail if the following conditions are set:
module-info.java
This results in using the module path instead of the class path of the javac
compiler. Now the javac
compiler also needs to be configured with --processor-module-path
so that the compiler can find the required annotation processors in the processor module path. The latest version of plexus-compiler-javac
only supports the --processorpath
parameter of javac
. This parameter is set by the maven-compiler-plugin
to the default class path. But when using Java 9+ modules the class path doesn't seem to be used by javac
to find the annotation processors. So, to use annotation processors in combination with Java 9+ modules, the plexus-compiler-javac
needs to support the related parameter.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.