maven配置

编程

配置Maven环境

配置Maven环境变量
MAVEN_HOME : D:servermavenapache-maven-3.6.3
PATH : %MAVEN_HOME%in

查看版本信息:mvn -v

https://repo1.maven.org/maven2

配置 apache-maven-3.6.3settings.xml文件

<?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:Repository</localRepository>

<pluginGroups>

</pluginGroups>

<proxies>

</proxies>

<servers>

</servers>

<!--拷贝mirrors节点下的全部内容-->

<mirrors>

<mirror>

<id>aliyun-public</id>

<mirrorOf>*</mirrorOf>

<name>aliyun public</name>

<url>https://maven.aliyun.com/repository/public</url>

</mirror>

<mirror>

<id>aliyun-central</id>

<mirrorOf>*</mirrorOf>

<name>aliyun central</name>

<url>https://maven.aliyun.com/repository/central</url>

</mirror>

<mirror>

<id>aliyun-spring</id>

<mirrorOf>*</mirrorOf>

<name>aliyun spring</name>

<url>https://maven.aliyun.com/repository/spring</url>

</mirror>

<mirror>

<id>aliyun-spring-plugin</id>

<mirrorOf>*</mirrorOf>

<name>aliyun spring-plugin</name>

<url>https://maven.aliyun.com/repository/spring-plugin</url>

</mirror>

<mirror>

<id>aliyun-apache-snapshots</id>

<mirrorOf>*</mirrorOf>

<name>aliyun apache-snapshots</name>

<url>https://maven.aliyun.com/repository/apache-snapshots</url>

</mirror>

<mirror>

<id>aliyun-google</id>

<mirrorOf>*</mirrorOf>

<name>aliyun google</name>

<url>https://maven.aliyun.com/repository/google</url>

</mirror>

<mirror>

<id>aliyun-gradle-plugin</id>

<mirrorOf>*</mirrorOf>

<name>aliyun gradle-plugin</name>

<url>https://maven.aliyun.com/repository/gradle-plugin</url>

</mirror>

<mirror>

<id>aliyun-jcenter</id>

<mirrorOf>*</mirrorOf>

<name>aliyun jcenter</name>

<url>https://maven.aliyun.com/repository/jcenter</url>

</mirror>

<mirror>

<id>aliyun-releases</id>

<mirrorOf>*</mirrorOf>

<name>aliyun releases</name>

<url>https://maven.aliyun.com/repository/releases</url>

</mirror>

<mirror>

<id>aliyun-snapshots</id>

<mirrorOf>*</mirrorOf>

<name>aliyun snapshots</name>

<url>https://maven.aliyun.com/repository/snapshots</url>

</mirror>

<mirror>

<id>aliyun-grails-core</id>

<mirrorOf>*</mirrorOf>

<name>aliyun grails-core</name>

<url>https://maven.aliyun.com/repository/grails-core</url>

</mirror>

<mirror>

<id>aliyun-mapr-public</id>

<mirrorOf>*</mirrorOf>

<name>aliyun mapr-public</name>

<url>https://maven.aliyun.com/repository/mapr-public</url>

</mirror>

</mirrors>

<profiles>

</profiles>

</settings>

配置全局settings
关闭所有项目(这样确保是全局配置),回到初始界面,打开Settings,在输入框输入maven,如图:

这里要注意要勾选Override,同时保证 Local repository 项填写的路径和配置文件中配置的路径是一致的。

打开你的本地项目,选择右边栏的Maven,再点击加载标签,下载jar包依赖,最后再点击第二个图标来刷新本地文件目录。

以上是 maven配置 的全部内容, 来源链接: utcz.com/z/515690.html

回到顶部