Maven Ant BuildException avec maven-antrun-plugin ... impossible de trouver le compilateur javac
Je suis en train de faire Maven appeler un ANT pour un code existant. L'ant s'appuie correctement par ant. Cependant, quand je l'appelle à l'aide de l'maven ant plugin, il échoue avec l'erreur suivante:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.6:run (default) on project CoreServices: An Ant BuildException has occured: The following error occurred while executing this line:
[ERROR] C:\dev\projects\build\build.xml:158: The following error occurred while executing this line:
[ERROR] C:\dev\projects\build\build.xml:62: The following error occurred while executing this line:
[ERROR] C:\dev\projects\build\build.xml:33: The following error occurred while executing this line:
[ERROR] C:\dev\projects\ods\build.xml:41: 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:\bea\jdk150_11\jre"
Mon javac existe au C:\bea\jdk150_11\bin et cela fonctionne pour toutes les autres choses. Je ne sais pas où Maven est d'amener cette version de JAVA_HOME. JAVA_HOME dans windows variables d'environnement est définie à C:\bea\jdk150_11\ comme il se doit.
Le Maven code que j'utilise pour appeler la build.xml est
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.6</version>
<executions>
<execution>
<phase>install</phase>
<configuration>
<target>
<ant antfile="../build/build.xml" target="deliver" >
</ant>
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
Vous devez vous connecter pour publier un commentaire.
Première chose: Pourquoi voulez-vous exécuter votre script ANT dans
install
phase et non danscompile
?La deuxième chose: Votre problème peut être causé par le fait que Maven exécute JRE au lieu de JDK, malgré le fait que votre JAVA_HOME points de JDK. Pour résoudre ce voir vous devez régler manuellement les dépendances maven-antrun-plugin. C'est juste un exemple: