rustock rustock - 10 months ago 247
Java Question

Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin

I'm trying compile using

mvn install
but I'm getting this error:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.0.2:compile (default-compile) on project test: Compilation failure: Compilation failure:

pom.xml file:

<project xmlns="" xmlns:xsi=""






How to fix it?


Your issue is most likely the <scope> of the dependency. When inside of the IDE, all scopes are added to the build path of the project. However, when running mvn only the appropriate scopes are added to the classpath for the javac command. For example, if you had a class in /src/main/java that imported a class from one of your dependencies scoped to <scope>test</scope>, the IDE would be able to build the project, but mvn would fail in the manner you are experiencing.