6

Java スタンドアロン用の Eclipse コンパイラでは、次のスタブのように、コマンドライン属性を介してコンパイル情報を XML に記録できます。

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

しかし、maven-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>
4

1 に答える 1

0

Eclipse の実装は、内部 jvm を使用するため、引数をplexus-compiler-eclipse受け入れません。forkしたがって、 のような jvm オプションのみを受け入れることができますMAVEN_OPTS

ただし、デフォルトの実装はplexus-compiler-javac、カスタムをサポートする ですexecutable。回避策は次のようforkになります: true に設定し、executable.

bash のラッパーについては、 https ://stackoverflow.com/a/37971000/3289354 にアクセスしてください。

于 2016-06-22T17:31:28.183 に答える