Arguments for eclipse compiler in Maven
Asked Answered
S

1

6

In the Eclipse Compiler for Java standalone, I am able to log in XML the compilation info via a command-line atribute, as in this stub:

java -jar ecj-4.3.2.jar -log compile.xml <classpath,files>

However, when I use maven-compiler-plugin with plexus-compiler-eclipse, it seems I am unable to pass this argument to the compiler, and I am not sure the cause of this, whether the plugin's compiler is another one, it doesn't spawn new processes (i even tried the executable parameter), or other reason.

Here is the pom.xml section:

<plugin>
   <groupId>org.apache.maven.plugins</groupId>
   <artifactId>maven-compiler-plugin</artifactId>
   <version>3.1</version>
   <configuration>
      <compilerId>eclipse</compilerId>
      <forceJavacCompilerUse>true</forceJavacCompilerUse>
      <!--<compilerArgument> -log compile.xml </compilerArgument>-->
      <compilerArgs>
        <arg>-log</arg>
        <arg>compile.xml</arg>
      </compilerArgs>
      <fork>true</fork>
      <verbose>true</verbose>
      <showDeprecation>true</showDeprecation>
      <showWarnings>true</showWarnings>
   </configuration>
   <dependencies>
      <dependency>
         <groupId>org.codehaus.plexus</groupId>
         <artifactId>plexus-compiler-eclipse</artifactId>
         <version>2.3</version>
      </dependency>
   </dependencies>
</plugin>
Sarchet answered 10/3, 2014 at 17:14 Comment(2)
It also doesn't work when you use <compilerArgument>-log compile.xml</compilerArgument>? I see that commented out in your question.Abroms
no, not really... I tried nearly every combination I could from the options presented in the compile:compile page of maven-compiler-pluginSarchet
N
0

The eclipse implementation is plexus-compiler-eclipse, it doesn't accept fork argument, as it uses the internal jvm. So, it can only accept jvm options like MAVEN_OPTS.

However, the default implementation is plexus-compiler-javac, which supports custom executable. The workaround may like this: set fork to true, and specify the executable.

For wraper in bash, you can visit here: https://mcmap.net/q/1919785/-use-maven-compiler-plugin-with-eclipse-compiler-and-lombok

Nace answered 22/6, 2016 at 17:31 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.