Reputation: 509
I have the following problem while trying to execute the compile goal on an Eclipse Java project with Maven:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project ...: Compilation failure
[ERROR] multi-catch statement is not supported in -source 1.5
[ERROR] (use -source 7 or higher to enable multi-catch statement)
The JDK in the Eclipse project is configured to use version 1.8.0_60.
The compiler compliance level is also set to 1.8: https://i.sstatic.net/SvsU3.jpg
However, the settings above are related to the Eclipse project configuration and not to Maven settings.
In Window -> Preferences, I have seen the compiler plugin is also set to 1.8: https://i.sstatic.net/6saSz.jpg
The question is: how to I tell Maven to use source 1.7 (or above)?
Upvotes: 2
Views: 917
Reputation: 4026
You can set the used JDK/JRE on the project java build path and compiler settings, but it is important that you click on:
maven->update project
before the change will take effect.
Upvotes: 0
Reputation: 2409
Try adding the following to pom.xml
<properties>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
</properties>
Upvotes: 3