2

単独で呼び出されたときに機能する ant ビルド ファイルがあります。Maven から呼び出すと、最初のいくつかのタスク (init、clean など) は正常に実行されますが、ビルドは次のように失敗します。

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.7:run (compile) on project maven-stream: An Ant BuildException has occur
ed: The following error occurred while executing this line:
[ERROR] C:\maven_projects\cm\Qlarius Underwriter\build.xml:24: Unable to find a javac compiler;
[ERROR] com.sun.tools.javac.Main is not on the classpath.
[ERROR] Perhaps JAVA_HOME does not point to the JDK.
[ERROR] It is currently set to "C:\Program Files\Java\jdk1.7.0_07\jre"
[ERROR] around Ant part ...<ant antfile="C:\maven_projects\cm/Qlarius Underwriter/build.xml">... @ 4:69 in C:\maven_projects\cm\target\antrun\build-ma
in.xml

Maven経由ではなく直接呼び出されたときに、アリがJavaを見つけるのはなぜですか?

pom.xml ファイルの ant 部分は次のとおりです。

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-antrun-plugin</artifactId>
    <version>1.7</version>
    <executions>
      <execution>
        <id>compile</id>
        <phase>compile</phase>
        <configuration>
          <target>
            <ant antfile="${basedir}/Qlarius Underwriter/build.xml">
              <target name="LifeQuote"/>
            </ant>
          </target>
        </configuration>
        <goals>
          <goal>run</goal>
        </goals>
      </execution>
    </executions>
</plugin>
4

1 に答える 1

1

エラーが示すように、JDK を指していません。JAVA_HOME を JRE ではなく JDK のルートに変更する必要があります。そうすれば、 を見つけることができますjavac

他のタスクは、使用していない場合はおそらく問題ありませinitcleanjavac

于 2013-02-02T16:34:16.840 に答える