Maven: modify the default JDK 修改Maven默认JDK

Categories: Development Notes; Tagged with: ; @ May 1st, 2013 11:18

I created a maven java project, and I want to use some new feature in Java7, but every time, after update the project, the JRE will be changed to 1.5 automatically.

After googling, got the solution: configure maven-compiler-plugin:

  <build>
    <finalName>J2EE</finalName>
    <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-compiler-plugin</artifactId>
          <version>2.1</version>
          <configuration>
            <source>1.7</source>
            <target>1.7</target>
          </configuration>
        </plugin>
    </plugins>
  </build>

 

http://stackoverflow.com/questions/3539139/what-causes-a-new-maven-project-in-eclipse-to-use-java-1-5-instead-of-java-1-6-b

<->



// Proudly powered by Apache, PHP, MySQL, WordPress, Bootstrap, etc,.