Maven: Viewing compile options?

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 7 or higher to enable try-with-resources)

How can find the -source 1.5 setting in my Maven compilation? I'm using a plain vanilla pom.xml which (as far as I can tell) isn't setting anything.

Answers


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:

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

or configure the plugin directly:

<plugin>
  <artifactId>maven-compiler-plugin</artifactId>
  <version>3.3</version>
  <configuration>
    <source>1.8</source>
    <target>1.8</target>
  </configuration>
</plugin>

Need Your Help

Visual studio debugger not working

c++ visual-studio debugging remote-debugging

I am using Microsoft Visual Studio debugger to debug a remote application. These are the steps I have done

Page refresh instead of Ajax Load without

php javascript jquery mysql ajax

On form submit i want to load a div with an updated list of a mysql table. I'am sending the form variables across to a php and posting them into a mysql table. the same page displays the full table...