修改Maven的jdk版本

在maven的默認配置中,對於jdk的配置是1.4版本,那麼建立/導入maven工程過程當中,工程中未指定jdk版本。apache

對工程進行maven的update,就會出現工程依賴的JRE System Library會自動變成JavaSE-1.4。maven

 

解決方案1:修改maven的默認jdk配置ui

           maven的conf\setting.xml文件中找到jdk配置的地方,修改以下:code

 

 

<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>

 

 

解決方案2:修改項目中pom.xml文件,這樣避免在導入項目時的jdk版本指定xml

          打開項目中pom.xml文件,修改以下:get

<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>
相關文章
相關標籤/搜索