maven configures the JDK version used by default

In the default configuration of maven, the configuration of jdk is version 1.4, then during the process of creating/importing the maven project, the jdk version is not specified in the project.
Update the project with maven, and the JRE System Library that the project depends on will automatically become JavaSE-1.4.

Solution 1: Modify the default jdk configuration
           of maven Find the place where the jdk configuration is found in the conf\setting.xml file of maven, and modify it as follows:
<profile>   
    <id>jdk1.6</id>    
    <activation>   
        <activeByDefault>true</activeByDefault>    
        <jdk>1.6</jdk>   
    </activation>    
    <properties>   
        <maven.compiler.source>1.6</maven.compiler.source>    
        <maven.compiler.target>1.6</maven.compiler.target>    
        <maven.compiler.compilerVersion>1.6</maven.compiler.compilerVersion>   
    </properties>   
</profile>  


Solution 2: Modify the pom.xml file in the project, so as to avoid specifying
          the pom.xml file in the project to be opened by the jdk version when importing the project, and modify it as follows:

<build>  
    <plugins>  
        <plugin>  
            <groupId>org.apache.maven.plugins</groupId>  
            <artifactId>maven-compiler-plugin</artifactId>  
            <configuration>  
                <source>1.6</source>  
                <target>1.6</target>  
            </configuration>  
        </plugin>  
    </plugins>  
</build>  

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326741939&siteId=291194637