Maven—Eclipse中配置Maven

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/wangshuxuncom/article/details/77745615
从Eclipse4.3开始Eclipse内部已集成了Maven,我们只需稍加配置即可使用:

1、点击“Window”菜单——>点击“Preferences”选项,出现下图:


2、点开“Maven”节点,出现下图:


3、点击“User Settings”节点——>点击“Browse…”,找到并选中“Maven软件根目录\conf\settings.xml”文件——>点击“打开(O)”按钮,出现下图:


4、点击“Apply and Close”按钮,至此配置结束。
5、使用Notepad++打开“Maven软件根目录\conf\settings.xml”文件,去掉152~157行代码注释,如下图所示:


6、将上面mirror标签进行如下修改:

<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>nexus</id>
      	<mirrorOf>*</mirrorOf>
	  	<name>alibaba</name>
      	<url>http://maven.aliyun.com/nexus/content/groups/public</url>
      </mirror>
</mirrors>

有效url地址:

      1、http://maven.aliyun.com/nexus/content/groups/public(推荐)

      2、http://repository.sonatype.org/content/groups/public/

      3、http://maven.oschina.net/content/groups/public/

      4、https://maven.atlassian.com/repository/public/

      5、http://repo1.maven.org/maven2/

      6、http://mirrors.ibiblio.org/maven2/

猜你喜欢

转载自blog.csdn.net/wangshuxuncom/article/details/77745615