zoukankan      html  css  js  c++  java
  • 在eclipse中使用maven

    1、在eclipse中安装插件m2eclipse

      (如果eclipse中没有插件的话,需要手动安装,如果eclipse中已经存在这个插件,则不需要安装)

      在Eclipse中的Help菜单下点击Instance NewSoftWare,会弹出窗口,点击add,输入

      Name:m2e

      Location:http://download.eclipse.org/technology/m2e/releases

      按照步骤安装插件即可

    2、下载maven并配置

      进入maven官网的下载页面:http://maven.apache.org/download.cgi下载maven项目

      进入maven根目录下的conf子目录,打开settings.xml进行配置修改

      (1)修改默认的本地仓库的位置<localRepository>d:/.m2/repository</localRepository>   #将默认的本地仓库的位置修改到d:/.m2/repository

      (2)修改默认的中央仓库镜像

    <mirrors>
        <mirror>  
              <id>aliyun</id>  
              <name>aliyun</name>  
            <url>http://maven.aliyun.com/nexus/content/groups/public/</url>  
              <mirrorOf>central</mirrorOf>  
        </mirror>  
         
    </mirrors> 
          
    <profiles>  
        <profile>  
              <id>nexus</id>  
              <repositories>  
                    <repository>  
                        <id>central</id>  
                        <url>http://repo.maven.apache.org/maven2</url>  
                        <snapshots>  
                            <enabled>false</enabled>  
                        </snapshots>  
                    </repository>  
                    <repository>  
                        <id>ansj-repo</id>  
                        <name>ansj Repository</name>  
                        <url>http://maven.nlpcn.org/</url>  
                        <snapshots>  
                            <enabled>false</enabled>  
                        </snapshots>  
                    </repository>  
              </repositories>  
          </profile>  
    </profiles>  
      
    <activeProfiles>  
          <activeProfile>nexus</activeProfile>  
    </activeProfiles>  

      保存所做的修改,并将这个settings.xml文件复制到d:/.m2目录下

    3、设置插件关联的maven程序

      在Eclipse中的window菜单下点击Preferences,找到maven:

      

      展开maven节点,选择Installations子节点,点击add按钮,选择你要添加的maven项目的根目录

      

    4、设置自己的本地仓库

      打开maven的子节点User Setting,这里修改为自定义仓库位置下的setting.xml文件,具体操作点击Browse…

      

    5、新建maven项目

      

      选择webapp项目

      

      maven项目就新建完成了。

    本文参考:

      使用Eclipse构建maven项目

  • 相关阅读:
    利用NABCD模型进行竞争性需求分析
    团队组建及项目启动
    结对项目
    归档二
    归档(1)
    自定义cell
    CoreData(数据持久化的方式)
    autoLayout(相对布局)二
    autoLayout (相对布局)1()
    细节知识点的记忆
  • 原文地址:https://www.cnblogs.com/mointor/p/8478949.html
Copyright © 2011-2022 走看看