eclipse中配置maven

来源:互联网 发布:手机淘宝网触屏版官网 编辑:程序博客网 时间:2024/05/01 01:31
  • maven安装

              下载地址为:http://maven.apache.org/download.cgi,解压后存放在指定目录。在系统的环境变量中设置MAVEN_HOME,并在path中添加maven的bin路径。

  • eclipse中安装maven插件

              1、在线安装,通过Help中的eclipse Maketplace进行安装。

             2、离线安装,eclipse在线安装经常由于网速过慢无法安装,此时只能通过下载离线包进行安装。离线包直接百度下载,下载后解压,将features中内容拷贝到eclipse\features中,plugins文件夹中内容拷贝到eclipse\plugins目录中。

  • maven配置

              在maven的安装文件中有一个conf/settting.xml文件。设置本地中央仓库存储路径,

       <localRepository>F:\repository\maven</localRepository>
               有时候网络较差,maven默认的中央仓库无法访问,需要设置镜像配置

  <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>     --><div>    <mirror>        <id>repository-master.mulesoft</id>        <mirrorOf>central</mirrorOf>        <name>repository-master.mulesoft.org.</name>        <url>https://repository-master.mulesoft.org/nexus/content/groups/public/</url>      </mirror>       <mirror>        <id>sonatype</id>        <mirrorOf>*</mirrorOf>        <name>repository.sonatype.org.</name>        <url>https://repository.sonatype.org/content/groups/forge/</url>      </mirror></div>  </mirrors>



  • 创建maven项目

             在eclipse的菜单中选择maven project后,修改pom.xml,添加

       <packaging>jar</packaging>       <url>http://mvnrepository.com/</url>

  • 参考资料

             http://jingyan.baidu.com/article/db55b609a994114ba20a2f56.html
             http://blog.csdn.net/chuyuqing/article/details/28879477

  • spring frame直接下载地址

             http://repo.spring.io/libs-release-local/org/springframework/spring/4.1.7.RELEASE/


0 0