I\'m trying to track down this compile error:
$ mvn compile
...
[ERROR] /.../Reader.java:[14,13] try-with-resources is not supported in -source 1.5
(use -source
This is because you are using a plain vanilla pom.xml
that you have this issue.
By default, the maven-compiler-plugin, which is called when compiling the sources, compiles with Java 5, whatever you have set up as $JAVA_HOME
:
Also note that at present the default source setting is 1.5 and the default target setting is 1.5, independently of the JDK you run Maven with.
To use a different compiler version (e.g. Java 8), you can set the following properties:
1.8
1.8
or configure the plugin directly:
maven-compiler-plugin
3.3
1.8