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>
相关推荐
铁皮哥11 小时前
【后端/Agent 开发】给你的项目配置一套 .claude/ 工作流:别再裸用 Claude Code 了!
java·windows·python·spring·github·maven·生活
摇滚侠20 小时前
Unsupported class file major version 61
java·maven
abcnull2 天前
Springboot+Vue2的Web项目小白入门Demo快速学习!
java·elementui·vue·maven·springboot·web·小白
myrh pdmd3 天前
maven导入spring框架
数据库·spring·maven
Ruci ALYS4 天前
SpringBoot Maven快速上手
spring boot·后端·maven
咱那飘逸的长发4 天前
Trae java项目配置全局maven和jdk
java·python·maven
FQNmxDG4S4 天前
Maven依赖管理:版本冲突解决与生命周期控制
java·数据库·maven
傻瓜搬砖人4 天前
Spring集成Web环境
java·spring·maven
likerhood5 天前
SLF4J: Failed to load class “StaticLoggerBinder“ 解决
java·log4j·maven
Dylan的码园6 天前
Maven基础架构与整体认识
java·junit·maven