Maven 的 settings.xml 文件配置

default

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<?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">

    <!-- maven 项目依赖包存储位置-->
    <localRepository>E:\maven\maven_repository</localRepository>

    <!-- Maven是否需要和用户交互以获得输入 -->
    <!-- <interactiveMode>true</interactiveMode> -->

    <!-- 是否离线环境 -->
    <offline>false</offline>

    <!-- 代理 -->
    <proxies>
        <!-- <proxy>
            <id>optional</id>
            <active>true</active>
            <protocol>http</protocol>
            <username>proxyuser</username>
            <password>proxypass</password>
            <host>proxy.host.net</host>
            <port>80</port>
            <nonProxyHosts>local.net|some.host.com</nonProxyHosts>
        </proxy> -->
    </proxies>

    <servers>
        <!-- 服务器地址和登录账号密码信息,如:阿里云服务器镜像仓库、nexus 的远程仓库等 -->
        <!-- id为服务的 url -->
        <!-- <server>
            <id>deploymentRepo</id>
            <username>repouser</username>
            <password>repopwd</password>
        </server> -->
    </servers>

    <!-- 远程仓库下载位置 -->
    <mirrors>
        <mirror>
            <id>alimaven</id>
            <name>aliyun maven</name>
            <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
            <mirrorOf>central</mirrorOf>
        </mirror>
    </mirrors>
    
    <!-- maven 编译环境配置 -->
    <profiles>
        <profile>
            <id>dev</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>
    </profiles>

    <!-- 让目的 profile生效 -->
    <activeProfiles>
        <activeProfile>dev</activeProfile>
    </activeProfiles>
</settings>
Licensed under CC BY-NC-SA 4.0
Gear(夕照)的博客。记录开发、生活,以及一些不足为道的思考……