0

I tried using a multi-catch statement in my Java Project. It doesn't give any errors in the IDE, but when I do Run As->Maven Install I get the following error (removed personal file paths as those are not relevant I think):

Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project: Compilation failure
MyClass.java:[137,39] multi-catch statement is not supported in -source 1.5
[ERROR] (use -source 7 or higher to enable multi-catch statement)

As per the other answers on this site, I tried changing the Java version in my project properties. However, everything was already set to Java 1.7. My Java Build Path

java build path

My Java Compiler settings:

java compiler settings

What should I change to be able to use Java 1.7 properly?

Eric
  • 1,210
  • 8
  • 25

1 Answers1

0

Okay somehow I missed this post before. I didn't come up at all when googling about the exact error strangely enough. To fix it I simply had to add:

<properties>
        <maven.compiler.source>1.7</maven.compiler.source>
        <maven.compiler.target>1.7</maven.compiler.target>

</properties>

to my project's pom.xml as maven was not using the java version from my eclipse project settings.

Eric
  • 1,210
  • 8
  • 25