Dio*_*ogo 5 java eclipse maven eclipse-jdt maven-compiler-plugin
在独立的Eclipse Java编译器中,我可以通过命令行属性(如下面的存根所示)以XML登录编译信息:
java -jar ecj-4.3.2.jar -log compile.xml <classpath,files>
Run Code Online (Sandbox Code Playgroud)
但是,当我将avenus-compiler-plugin与plexus-compiler-eclipse一起使用时,似乎无法将此参数传递给编译器,并且我不确定其原因,即插件的编译器是否为另一个编译器,它不会不会产生新进程(我什至尝试过可执行参数)或其他原因。
这是pom.xml部分:
<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>
Run Code Online (Sandbox Code Playgroud)
Eclipse 实现是plexus-compiler-eclipse,它不接受fork参数,因为它使用内部 jvm。因此,它只能接受 jvm 选项,例如MAVEN_OPTS.
但是,默认实现是plexus-compiler-javac,它支持自定义executable。解决方法可能如下:设置fork为 true,并指定executable.
对于bash中的包装器,您可以访问这里:/sf/answers/2657970031/
| 归档时间: |
|
| 查看次数: |
888 次 |
| 最近记录: |