maven环境搭建

2023-12-13 03:29:43

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

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

settings.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>

文章来源:https://blog.csdn.net/h_e_l_l_o_______/article/details/134816969
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。