简单配置和使用Maven

1,下载Maven 从:https://maven.apache.org/download.cgi

简单配置和使用Maven

其实两个都一样,

2,安装过程

解压你下载的包,随意放哪里都可以 ,假设 我放在了 D:\JavaTools\maven\apache-maven-3.3.9 。

简单配置和使用Maven

3, 加入环境变量

简单配置和使用Maven

TEST :  执行 mvn 应该可以看到如下提示

简单配置和使用Maven

4,配置

1) D:\JavaTools\maven\apache-maven-3.3.9\conf   这里有个settings.xml

2)  C:\Users\[当前用户名]\.m2  这个下面默认是空的。

新建一个 settings.xml

假如,用aliyun的 Maven 库

<?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>D:/JavaTools/maven/my_local_repository</localRepository>

<pluginGroups>
    </pluginGroups>

<proxies>
    </proxies>

<!--设置 Nexus 镜像,后面只要本地没对应的以来,则到 Nexus 去找-->
    <mirrors>
      
          <mirror>
            <id>nexus-aliyun</id>
            <mirrorOf>*</mirrorOf>
            <name>Nexus aliyun</name>
            <url>http://maven.aliyun.com/nexus/content/groups/public</url>
        </mirror>
    </mirrors>

<profiles>
        <profile>
            <id>nexus</id>
            <repositories>
                <repository>
                    <id>nexus-releases</id>
                    <url>http://nexus-releases</url>
                    <releases>
                        <enabled>true</enabled>
                    </releases>
                    <snapshots>
                        <enabled>true</enabled>
                    </snapshots>
                </repository>
                <repository>
                    <id>nexus-snapshots</id>
                    <url>http://nexus-snapshots</url>
                    <releases>
                        <enabled>true</enabled>
                    </releases>
                    <snapshots>
                        <enabled>true</enabled>
                    </snapshots>
                </repository>
            </repositories>
            <pluginRepositories>
                <pluginRepository>
                    <id>nexus-releases</id>
                    <url>http://nexus-releases</url>
                    <releases>
                        <enabled>true</enabled>
                    </releases>
                    <snapshots>
                        <enabled>true</enabled>
                    </snapshots>
                </pluginRepository>
                <pluginRepository>
                    <id>nexus-snapshots</id>
                    <url>http://nexus-snapshots</url>
                    <releases>
                        <enabled>true</enabled>
                    </releases>
                    <snapshots>
                        <enabled>true</enabled>
                    </snapshots>
                </pluginRepository>
            </pluginRepositories>
        </profile>
    </profiles>

<activeProfiles>
        <activeProfile>nexus</activeProfile>
    </activeProfiles>

</settings>

覆盖这两个地方。

如此已经完成了Maven的基础配置 ,

5,在项目中,如果已经配置 了  C:\Users\[当前用户名]\.m2\settings.xml ,其实IDEA 会自动加载配置,将下载的包放到  D:/JavaTools/maven/my_local_repository

上一篇:[洛谷P4001][BJOI2006]狼抓兔子


下一篇:mongodb python image 图像存储读取