zoukankan      html  css  js  c++  java
  • maven的配置文件settings.xml——配置jar包下载源和maven的项目jdk默认版本

    1、

    2、

    3、添加settings.xml文件,这里我主要添加两项

    第一个:jar包下载源(使用阿里云的)

    第二个:配置创建maven项目自动使用的jdk

     

    如果选择文件之后出现Could not read settings.xml, assuming default values的错误,要注意一下几点:

    1、在  settings  配置文件中一定不能有中文,包括注释  <!--   -->  内部也不能有。

    2、路径一定要写对:比如说  <localRepository>D:/Maven/repo/</localRepository>  中的路径使用 “/”  而非  windows 路径中的  “”。

    3、不管用什么编辑器,在保存的时候一定要保存为   “UTF-8”。

    settings.xml文件内容含义:

    1. 默认jdk采用java8

    2. 配置阿里云镜像和私服镜像, 并且先从阿里云下载, 下载不到的再去私服下载

    <?xml version="1.0" encoding="UTF-8"?>
    <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" 
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
    
        <!-- 本地仓库的位置 -->
        <localRepository>${user.home}/.m2/repository</localRepository>
      
        <!-- Apache Maven 配置 -->
        <pluginGroups/>
        <proxies/>
    
        <!-- 私服发布的用户名密码 -->
        <servers>
            <server>
                <id>releases</id>
                <username>deployment</username>
                <password>He2019</password>
            </server>
            <server>
                <id>snapshots</id>
                <username>deployment</username>
                <password>He2019</password>
            </server>
        </servers>
        
        <!-- 阿里云镜像 -->
        <mirrors>
            <mirror>
                <id>alimaven</id>
                <name>aliyun maven</name>
                <!-- https://maven.aliyun.com/repository/public/ -->
                <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
                <mirrorOf>central</mirrorOf>
            </mirror>
        </mirrors>
    
        <!-- 配置: java8, 先从阿里云下载, 没有再去私服下载  -->
        <!-- 20190929 hepengju 测试结果: 影响下载顺序的是profiles标签的配置顺序(后面配置的ali仓库先下载), 而不是activeProfiles的顺序 -->
        <profiles>
            <!-- 全局JDK1.8配置 -->
            <profile>
                <id>jdk1.8</id>
                <activation>
                    <activeByDefault>true</activeByDefault>
                    <jdk>1.8</jdk>
                </activation>
                <properties>
                    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
                    <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>
    
            
            <!-- Nexus私服配置: 第三方jar包下载, 比如oracle的jdbc驱动等 -->
            <profile>
                <id>dev</id>
                <repositories>
                    <repository>
                        <id>nexus</id>
                        <url>http://nexus.hepengju.cn:8081/nexus/content/groups/public/</url>
                        <releases>
                            <enabled>true</enabled>
                        </releases>
                        <snapshots>
                            <enabled>true</enabled>
                        </snapshots>
                    </repository>
                </repositories>
                <pluginRepositories>
                    <pluginRepository>
                        <id>public</id>
                        <name>Public Repositories</name>
                        <url>http://nexus.hepengju.cn:8081/nexus/content/groups/public/</url>
                    </pluginRepository>
                </pluginRepositories>
            </profile>
            
            <!-- 阿里云配置: 提高国内的jar包下载速度 -->
            <profile>
                <id>ali</id>
                <repositories>
                    <repository>
                        <id>alimaven</id>
                        <name>aliyun maven</name>
                        <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
                        <releases>
                            <enabled>true</enabled>
                        </releases>
                        <snapshots>
                            <enabled>true</enabled>
                        </snapshots>
                    </repository>
                </repositories>
                <pluginRepositories>
                    <pluginRepository>
                        <id>alimaven</id>
                        <name>aliyun maven</name>
                        <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
                    </pluginRepository>
                </pluginRepositories>
            </profile>
    
        </profiles>
        
        <!-- 激活配置 --> 
        <activeProfiles>
            <activeProfile>jdk1.8</activeProfile>
            <activeProfile>dev</activeProfile>
            <activeProfile>ali</activeProfile>
        </activeProfiles>
    </settings>
  • 相关阅读:
    06python 中的递归函数(python函数)
    05python 的内置函数以及匿名函数(python函数)
    Elasticsearch6.x集群部署
    SuperMap iServer之CAS单点登陆搭建流程
    大数据系列文章-Hadoop的HDFS读写流程(二)
    大数据系列文章-Hadoop基础介绍(一)
    SuperMap iObjects for Spark使用
    Hadoop集群+Spark集群搭建(一篇文章就够了)
    Linux配置 xampp下的https证书(腾讯云申请)
    SuperMap iServer 9D HBase使用
  • 原文地址:https://www.cnblogs.com/kongbursi-2292702937/p/14668825.html
Copyright © 2011-2022 走看看