1

I'm new to maven. I just joined a new company and they use maven for all their projects. I set up the company's server for maven dependencies. I'm using Fedora.

For most of the projects everything goes well. For some of them I get this error when running mvn compile:

Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.0.2:compile (default-compile) on project xlayer: Fatal error compiling: Error while executing the external compiler. Error while executing process. Cannot run program "java -classpath "${env.M2_REPO}/org/eclipse/jdt/core/3.4.2.v_883_R34x/core-3.4.2.v_883_R34x.jar" org.eclipse.jdt.internal.compiler.batch.Main -sourcepath "src/main"" (in directory "/home/es/ion_projects/XLayer"): error=2, No such file or directory -> [Help 1]

I looked several hours on the web, nothing would do. PATH and JAVA_HOME are correctly set.

Running mvn --version gives:

Apache Maven 3.0.4 (rNON-CANONICAL_2013-01-22_13-18_mockbuild; 2013-01-22 14:18:29+0100) Maven home: /usr/share/maven Java version: 1.7.0_17, vendor: Oracle Corporation Java home: /home/es/kit/jdk1.7.0_17/jre Default locale: en_US, platform encoding: UTF-8 OS name: "linux", version: "3.8.3-103.fc17.i686", arch: "i386", family: "unix"

UPDATE:

In the pom.xml (of parent, but that is not important), the maven-compiler-plugin defined the executable as

java -classpath "${env.M2_REPO}/org/eclipse/jdt/core/${org.eclipse.jdt.core.version}/core-${org.eclipse.jdt.core.version}.jar" org.eclipse.jdt.internal.compiler.batch.Main -sourcepath "src/main"

in order to use the Eclipse compiler instead of sun's comiler. This worked for developpers using windows. On linux, maven tries to execute "java -classpath ...." as a single command, which does not exist.

I am still loking for a solution. the only hack I found was to put the executable "java -classpath ..." in an executable file on my machine and put the name of that file in the tag on maven.

Emil Salageanu
  • 997
  • 1
  • 10
  • 24
  • 1
    In the parent pom, for the compiler plugin, I have java -classpath "${env.M2_REPO}/org/eclipse/jdt/core/${org.eclipse.jdt.core.version}/core-${org.eclipse.jdt.core.version}.jar" org.eclipse.jdt.internal.compiler.batch.Main -sourcepath "src/main" – Emil Salageanu Apr 04 '13 at 15:47
  • Overriding, in my pom.xml, the org.apache.maven.plugin and putting an absolute path to javac seems to work. but is not a nice solution for me. – Emil Salageanu Apr 04 '13 at 15:56

0 Answers0