Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why Maven project is tied to J2SE-1.5 by default?

If I create default empty based on no archetype Maven project in Eclipse, it will be based on J2SE-1.5.

enter image description here

I am to change manually both Build Path entry and code compliance.

Why?

How to make it be other?

like image 438
Suzan Cioc Avatar asked Jan 20 '14 20:01

Suzan Cioc


People also ask

What is default compile in Maven?

The Compiler Plugin is used to compile the sources of your project. Since 3.0, the default compiler is javax. tools. JavaCompiler (if you are using java 1.6) and is used to compile Java sources.

Does Maven work with Java 11?

If there's some dependency that you can't update due to compatibility issues in your project than leave it as is. Chances are that it just runs fine with Java 11. Hint: You can speed up multi-module Maven projects by using parallel builds, e.g. mvn -T 4 compile compiles all modules in parallel on 4 CPU cores.


1 Answers

@axtavt is right, add source level configuration to your project. But do not configure maven-compiler-plugin, simply put this properties into pom.xml.

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

After this refresh maven configuration in Eclipse.

like image 130
MariuszS Avatar answered Oct 22 '22 05:10

MariuszS