Maven配置阿里镜像+配置全局或局部JDK

maven的settings文件(apache-maven-3.5.4\conf\settings.xml)
配置阿里云镜像
<mirrors>

  <mirror> 
    <id>alimaven</id> 
    <name>aliyun maven</name> 
    <url>http://maven.aliyun.com/nexus/content/groups/public/</url> 
    <mirrorOf>central</mirrorOf> 
  </mirror> 

</mirrors>

配置本地库位置

<localRepository>E:\Maven\maven-lib</localRepository>

设置全局的jdk
<profile>  
    <id>jdk18</id>  
    <activation> <activeByDefault>true</activeByDefault>  
        <jdk>1.8</jdk>  
    </activation>  
    <properties>  
        <maven.compiler.source>1.8</maven.compiler.source>  
        <maven.compiler.target>1.8</maven.compiler.target>  
        <maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion>  
    </properties>   
</profile>


设置局部的jdk,在项目的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>


版权声明:本文为a874493738原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。