Maven的装置以及改也阿里云生充斥依赖

 

利用JAVA工程管理更多之jar包,担心导错了,多导了,漏导了怎么处置?

转移一个IDE项目后项目会不会面发生一堆BUG,看之头皮发麻?

友好写的代码放在别人的机器及运行会不会师来题目?

Maven的强硬毋庸置疑,当以Maven后上述这一个都未是问题,然则配置maven是一致桩耐心的工作,基本步骤总结如下:

一、下载
http://maven.apache.org/download.cgi
啊足以直接以eclipse工具中下载,点击eclipse菜单栏Help->Eclipse
马克(Mark)etplace搜索关键字maven到插件Maven Integration for Eclipse
并点击安装即可

搭Maven工作环境(配置环境变量)
新建:MAVEN_HOME
路径(例如):D:\360Downloads\tools\marven3.5\apache-maven-3.5.0
丰盛到path配置文件被:;%MAVEN_HOME%\bin;
亚、配置好后证实
输入mvn -version
打响后相会像以下提醒:

Microsoft Windows [版本 6.1.7601]
版权所有 (c) 2009 Microsoft Corporation。保留有权利。

C:\Users\Administrator>mvn -version
Apache Maven 3.5.0 (ff8f5e7444045639af65f6095c62210b5713f426;
2017-04-04T03:39:0
6+08:00)
Maven home:
D:\360Downloads\tools\marven3.5\apache-maven-3.5.0-bin\apache-maven-
3.5.0\bin\..
Java version: 1.8.0_121, vendor: Oracle Corporation
Java home: D:\Program Files\Java\jdk1.8.0_121\jre
Default locale: zh_CN, platform encoding: GBK
OS name: “windows 7”, version: “6.1”, arch: “amd64”, family: “windows”

其三、修改默认下载地址,默认下载地址以C盘中如下:

C:\Users\Administrator\.m2
指出更换一个地点,制止系统变慢,重装系统也未会晤潜移默化。
如:D:\eee\1701javaee_2\maveninport_aliyun\.m2

季、将装路径下之apache-maven-3.5.0\conf\settings.xml文件复制一份到新地方的.m2目录下边(与repository在同目录)。

五、打开eclipse将Maven工程上加到eclipse工具被。
window->preferences->maven->installations->add->maven安装路径。

六、打开settings.xml,修改如下2只地点的情:
1、此处为寄放下载倚重存地点,在文书第53执行:

原始文件:
<!– localRepository
| The path to the local repository maven will use to store artifacts.
|
| Default: ${user.home}/.m2/repository
<localRepository>/path/to/local/repo</localRepository>
–>
改后的文件:
<!– localRepository
| The path to the local repository maven will use to store artifacts.
|
| Default: ${user.home}/.m2/repository
<localRepository>/path/to/local/repo</localRepository>
–>
<localRepository>D:\eee\1701javaee_2\maveninport_aliyun\.m2\repository</localRepository>

 

2、此处为修改也于阿里云服务器上下载看重,强烈提议更换,下载速度会快很多,在文件第160举行

故文件:
<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&lt;/url&gt;
</mirror>
–>
</mirrors>

改后底公文:
<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&lt;/url&gt;
</mirror>
–>

<!– 阿里云镜像 下充斥配置
–>

<mirror>

<id>nexus-aliyun</id>

<mirrorOf>*</mirrorOf>
<name>Nexus
aliyun</name>

<url>http://maven.aliyun.com/nexus/content/groups/public&lt;/url&gt;
</mirror>

<!– 另一个备用模板
–>

<!– <mirror>
<id>alimaven</id>
<mirrorOf>central</mirrorOf>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/&lt;/url&gt;
</mirror>–>

</mirrors>

成就后还启eclipse.

相关文章