4

I am using Eclipse as IDE. When I right click on the project, then click "Maven Update", my Java version changes to 1.5. Here is what I did so far:

  1. I changed "Java build path" to "workspace default jre 1.8.0_25"
  2. Then changed "java compiler" to 1.8
  3. Then changed "project facets">java>1.8
  4. Lastly Changed pom.xml java version to 1.8
<build>
    <plugins>
        <plugin>
            <groupId>org.eclipse.jetty</groupId>
            <artifactId>jetty-maven-plugin</artifactId>
            <version>9.1.3.v20140225</version>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugin</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.2</version>
            <configuration>
                <source>1.8</source>
                <target>1.8</target>
            </configuration>
        </plugin>
    </plugins>
</build>

How can I keep it to 1.8 version?

Tunaki
  • 132,869
  • 46
  • 340
  • 423
asdlfkjlkj
  • 2,258
  • 6
  • 20
  • 28
  • Someone please edit the post. I added some code but it is not showing. I don't know why. – asdlfkjlkj Feb 14 '15 at 08:08
  • For the code format issue, see http://meta.stackoverflow.com/questions/252114/how-to-format-code-after-item-list –  Feb 14 '15 at 08:20

1 Answers1

6

There's a typo in the groupId of the maven-compiler-plugin in your pom.xml file: it should be org.apache.maven.plugins.

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

Note that the groupId actually defaults to org.apache.maven.plugins so you could also omit it.

By default, the JRE used by m2e is 1.5, see this question : Eclipse JRE System Library [J2SE-1.5]

Community
  • 1
  • 1
Tunaki
  • 132,869
  • 46
  • 340
  • 423