配置maven
你好! 这是新环境配置 MAVEN 所展示的欢迎页。如果你想学习如何使用, 可以仔细阅读这篇文章,了解一下Maven的基本语法知识。
首先下载maven 并解压
获取下面链接
链接:https://pan.baidu.com/s/1T6PGCX0GoqdspMpyPo4jPw?pwd=qvji
提取码:qvji
1.后自己建一个文件下下面
2.解压
配置环境变量
在系统变量中进行以下操作
然后找到path
%MAVEN_HOME%\bin
控制台确认是否成功
win+R
cmd
输入mvn -v
可以看到对应的版本
Java的版本也能看到
在idea中配置
在setting中搜索maven
然后配置一下
但是maven都是国外获取仓储内容 所以需要改一下淘宝OR阿里镜像
最好拿编译器修改 能看明显看出来
再加一个自己仓储位置(根据自己路径 ,每个人都不一样~~~~~~我们不一样我们不一样 好像是一首歌)
<localRepository>D:\Maven\apache-maven-3.9.8-bin\repository</localRepository>
下面jdk根据自己版本(mvn -v 下面就有jdk版本) 这里有两个(一个截图一个代码的)
Maven项目的默认java JDK版本都是1.5 ,修改1.8后每回项目生成就是版本为1.8
must 把原有的镜像注释 然后加两个新的( 阿里云仓库,maven配置)
<!-- mirrors
| This is a list of mirrors to be used in downloading artifacts from remote repositories.
|
| It works like this: a POM may declare a repository to use in resolving certain artifacts.
| However, this repository may have problems with heavy traffic at times, so people have mirrored
| it to several places.
|
| That repository definition will have a unique id, so we can create a mirror reference for that
| repository, to be used as an alternate download site. The mirror site will be the preferred
| server for that repository.
|-->
<!-- <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>maven-default-http-blocker</id>
<mirrorOf>external:http:*</mirrorOf>
<name>Pseudo repository to mirror external repositories initially using HTTP.</name>
<url>http://0.0.0.0/</url>
<blocked>true</blocked>
</mirror>
</mirrors> -->
<!-- 阿里云仓库 -->
<mirror>
<id>nexus-aliyun</id>
<mirrorOf>*</mirrorOf>
<name>Nexus aliyun</name>
<url>http://maven.aliyun.com/nexus/content/groups/public</url>
</mirror>
<profile>
<id> jdk-21.0.2</id>
<activation>
<jdk>21.0.2</jdk>
<activeByDefault>true</activeByDefault>
</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>
检验镜像
mvn help:system
这里就ok了 拜拜
出现method ‘void ()’ not found问题
如果有意外 再留一会吧
但如果有这个错误
Caused by: java.lang.RuntimeException: org.codehaus.plexus.component.repository.exception.ComponentLookupException: com.google.inject.ProvisionException: Unable to provision, see the following errors:
1) [Guice/ErrorInjectingConstructor]: NoSuchMethodError: DefaultModelValidator: method 'void <init>()' not found
那就是maven版本太高了 2021的idea和maven3.9就会报错 那就降低版本
拿走不谢
链接:https://pan.baidu.com/s/146d8EHUCG61ehZDMyj5Qmw?pwd=fkl8
提取码:fkl8