Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Java by (2.6k points)

I imported a Maven project and it used Java 1.5 even though I have 1.6 configured as my Eclipse default Preferences->Java->Installed JREs.

When I changed the Maven project to use the 1.6 JRE it still had the build errors left over from when the project was using Java 1.5 (I described these build errors earlier in: I have build errors with m2eclipse but not with maven2 on the command line - is my m2eclipse misconfigured?)

I'm going to delete the project and try again but I want to make sure this time that it uses Java 1.6 from the start to see if this eliminates the build problems.

How do I make sure the project uses Java 1.6 when I import it?

1 Answer

0 votes
by (46k points)

The m2eclipse plugin doesn't use Eclipse failures, the m2eclipse plugin receives the settings from the POM. So if you require a Maven project to be configured to use Java 1.6 frames when imported under Eclipse, configure the maven-compiler-plugin properly, as I already suggested:

<plugin>

  <groupId>org.apache.maven.plugins</groupId>

  <artifactId>maven-compiler-plugin</artifactId>

  <version>2.1</version>

  <configuration>

    <source>1.6</source>

    <target>1.6</target>

  </configuration>

</plugin>

If your project is previously imported, update the project arrangement (right-click on the project then Maven V Update Project Configuration).

Browse Categories

...