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

If I create an empty default without the artetype Maven project in Eclipse , it will be based on J2SE-1.5 .

enter image description here

I have to manually change both the assembly path entry and the code match.

Why?

How to make it different?

+7
java eclipse maven m2e
source share
2 answers

@axtavt is correct, add the source level configuration to your project. But don't configure maven-compiler-plugin , just put these properties in pom.xml .

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

After this configuration, maven updates in Eclipse.

+12
source share

It corresponds to the source and target maven-compiler-plugin settings, which are 1.5 by default.

If you change them, the generated project will use a different version:

 <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.1</version> <configuration> <source>1.7</source> <target>1.7</target> </configuration> </plugin> 

Please note: if you change the Eclipse project’s compliance settings without changing the maven-compiler-plugin settings, your Maven assemblies will not be compatible with your Eclipse environment.

+6
source share

All Articles