maven环境搭建

maven历史版本下载:https://archive.apache.org/dist/maven/

  • 新建系统变量
  • 编辑Path,添加bin目录
  • mvn -v测试查看版本号
  • conf目录下新建repository文件夹,作为本地仓库

settings.xml

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:\apache-maven-3.6.1\conf\repository</localRepository>
  
  <pluginGroups>
  </pluginGroups>

  <proxies>
  </proxies>

  <servers>
  </servers>

  <mirrors>
    <!-- 阿里镜像 -->
	<mirror>
	    <id>alimaven</id>
	    <mirrorOf>central</mirrorOf>
	    <name>aliyun maven</name>
	    <url>http://maven.aliyun.com/nexus/content/repositories/central/</url>
	</mirror>
	<mirror>
	    <id>alimaven</id>
	    <name>aliyun maven</name>
	    <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
	    <mirrorOf>central</mirrorOf>
	</mirror>
	<!--maven镜像-->
	<mirror>
	    <id>central</id>
	    <name>Maven Repository Switchboard</name>
	    <url>http://repo1.maven.org/maven2/</url>
	    <mirrorOf>central</mirrorOf>
	</mirror>
	<mirror>
	    <id>repo2</id>
	    <mirrorOf>central</mirrorOf>
	    <name>Human Readable Name for this Mirror.</name>
	    <url>http://repo2.maven.org/maven2/</url>
	</mirror>
	<!-- 中央仓库在中国的镜像 -->
	<mirror>
	    <id>maven.net.cn</id>
	    <name>oneof the central mirrors in china</name>
	    <url>http://maven.net.cn/content/groups/public/</url>
	    <mirrorOf>central</mirrorOf>
	</mirror>
	<!--ibiblio镜像-->
	<mirror>
	    <id>ibiblio</id>
	    <mirrorOf>central</mirrorOf>
	    <name>Human Readable Name for this Mirror.</name>
	    <url>http://mirrors.ibiblio.org/pub/mirrors/maven2/</url>
	</mirror>
	<!--Jboss镜像-->
	<mirror>
	    <id>jboss-public-repository-group</id>
	    <mirrorOf>central</mirrorOf>
	    <name>JBoss Public Repository Group</name>
	    <url>http://repository.jboss.org/nexus/content/groups/public</url>
	</mirror>
	<!--google镜像-->
	<mirror>
	    <id>google-maven-central</id>
	    <name>Google Maven Central</name>
	    <url>https://maven-central.storage.googleapis.com
	    </url>
	    <mirrorOf>central</mirrorOf>
	</mirror>
  </mirrors>
  
  <profiles>
  	<!--指定jdk的版本-->
    <profile>    
	    <id>jdk1.8</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>
</settings>
相关推荐
zjjuejin10 小时前
Maven 云原生时代面临的八大挑战
java·后端·maven
摆烂且佛系1 天前
IDEA Maven 仓库配置优先级
github·maven·intellij-idea
momo_via2 天前
maven下载与安装及在IDEA中配置maven
java·maven·intellij-idea
李贺梖梖2 天前
Maven 设置项目编码,防止编译打包出现编码错误
java·maven
洛克大航海2 天前
Ubuntu安装JDK与Maven和IntelliJ IDEA
ubuntu·jdk·maven·intellij idea
假客套2 天前
2025 FastExcel在Java的Maven项目的导出和导入,简单易上手,以下为完整示例
java·maven·fastexcel
有梦想的攻城狮2 天前
Maven中的settings.xml文件配置详解
xml·java·maven·settings.xml
李贺梖梖3 天前
maven本地仓库有相应的依赖,依旧会从远程仓库拉取问题的原因及解决
maven
纳于大麓3 天前
Android Maven私服搭建(Windows)
java·maven
诸神缄默不语3 天前
Maven用户设置文件(settings.xml)配置指南
xml·java·maven