首页 > 代码库 > maven配置全局的jdk和配置局部的jdk

maven配置全局的jdk和配置局部的jdk

配置全局的jdk需要修改maven的setting.xml文件

<profile>  
    <id>jdk17</id>  
    <activation>  
        <activeByDefault>true</activeByDefault>  
        <jdk>1.7</jdk>  
    </activation>  
    <properties>
        <maven.compiler.source>1.7</maven.compiler.source>  
        <maven.compiler.target>1.7</maven.compiler.target>  
   <maven.compiler.compilerVersion>1.7</maven.compiler.compilerVersion> </properties> </profile>

设置局部的jdk,在maven项目的pom.xml文件中添加如下build元素

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

 

maven配置全局的jdk和配置局部的jdk