当我们收到一份IDEA的maven工程压缩包我们该如何使其在我们自己的IDEA上运行起来?
首先我们需要在自己的电脑上下载maven,并配置好环境。
首先我们先解压缩该文件
然后使用IDEA打开
点击信任项目
接下来我们逐步进行
1.修改maven设置
将主路径,用户设置文件修改为自己的。
应用确定即可
2.修改maven设置文件中的源路径
找到对应路径文件,使用记事本打开。
"C:\HHHH\maven\apache-maven-3.6.3\conf\settings.xml"
查找mirrors关键字,你会看到如下内容,我这个是我已经修改过的了。
<!-- 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.
|-->
##这是一大段注释
##在这个字段内修改<mirror>的内容即可
<mirrors>
##这是阿里云的地址
<mirror>
<id>aliyun</id>
<name>Aliyun Maven Repository</name>
<url>https://maven.aliyun.com/repository/public</url>
<mirrorOf>central</mirrorOf>
<blocking>false</blocking>
</mirror>
</mirrors>
3.配置jdk,修改为可用jdk即可
4.依次点击clean,compile,package。下载补全缺失项
点击clean
点击compile,缺失项会开始下载,由于我们设置的是阿里云,因此下载地址是阿里云。
点击package
经过这3步基本上缺失的都会下载好,如图已经不标红了
5.注意pom.xml文件是否有标红
如图,我们可以删除掉2后面的".“然后再打上”.",IDEA会跳出它有的提示,我们选取一个即可
运行结果