每日总结
今天的内容:
配置了基本的Maven环境。
进入官网下载Maven文件:Maven – Download Apache Maven
解压Maven文件。
配置环境变量:
1. M2_HOME(指定Maven文件的解压路径)

2. 配置Maven的bin目录进Path:%M2_HOME%\bin

3.测试:
使用cmd执行,mvn -v 命令
成功结果如下:

遇到的问题:
Maven下载东西速度过慢,原因是Maven默认的插件、Jar包下载的地址是外网的连接。
解决方案:
修改Maven安装目录下面的conf目录中的setting.xml配置文件中<mirrors></mirrors>的内容。添加镜像地址。
示例代码片段:
<mirrors> <!-- mirror | Specifies a repository mirror site to use instead of a given repository. The repository that | this mirror serves has an ID that matches the mirrorOf element of this mirror. IDs are used | for inheritance and direct lookup purposes, and must be unique across the set of mirrors. | <mirror> <id>mirrorId</id> <mirrorOf>repositoryId</mirrorOf> <name>Human Readable Name for this Mirror.</name> <url>http://my.repository.com/repo/path</url> </mirror> --> <mirror> <id>alimaven</id> <mirrorOf>central</mirrorOf> <name>aliyun maven</name> <url>http://maven.aliyun.com/nexus/content/repositories/central/</url> </mirror> <!-- 中央仓库1 --> <mirror> <id>repo1</id> <mirrorOf>central</mirrorOf> <name>Human Readable Name for this Mirror.</name> <url>http://repo1.maven.org/maven2/</url> </mirror> <!-- 中央仓库2 --> <mirror> <id>repo2</id> <mirrorOf>central</mirrorOf> <name>Human Readable Name for this Mirror.</name> <url>http://repo2.maven.org/maven2/</url> </mirror> </mirrors>
明天的计划:对Maven进行基础的了解。

浙公网安备 33010602011771号