zoukankan      html  css  js  c++  java
  • Maven环境搭建以及建立Maven项目

    1.maven下载地址http://maven.apache.org/download.cgi

    2.下载后直接解压,存放路径自己决定,我是放在C:Program FilesJava路径下。

    3.配置maven环境:我的电脑->属性->高级系统设置->新建环境变量:MAVEN_HOME , 变量值为刚解压的maven路径,我的是:C:Program FilesJavaapache-maven-3.5.0。再在Path变量中加上:%MAVEN_HOME%in;

    注意:配置Maven时,环境变量里面一定要存在JAVA_HOME,即要配置好JDk的环境。

    4.windows+r键输入cmd,打开dos命令,输入mvn -v 进行测试

    5.Eclipse配置Maven。Window->Preferences->Maven->Installations->Add->Directory 选择刚解压的Maven的路径,点击Finish,然后将它选为默认。

    6.更改本地仓库的地址:conf/settings.xml------><localRepository>。在刚解压的maven中的conf/settings.xml中修改。加上 <localRepository>节点,其中路径自己决定。

    7.回到Eclispe中,打开Window->Preferences->Maven->User Settings->Global Settings选择到上一步修改的那个settings.xml文件,点击OK即可。

    项目报如下错误的解决办法

    Description Resource Path Location Type
    Failure to transfer org.apache.maven.plugins:maven-compiler-plugin:pom:3.6.1 from https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer artifact org.apache.maven.plugins:maven-compiler-plugin:pom:3.6.1 from/to central (https://repo.maven.apache.org/maven2): Received fatal alert: protocol_version pom.xml /crm9 line 1 Maven Configuration Problem

    找到Maven本地仓库的目录即C:UsersAdministrator.m2 epository

    删除C:UsersAdministrator.m2 epositoryorgapachemavenpluginsmaven-compiler-plugin下的所有文件

    然后右击项目选择【Maven】->【Update Project】

    发现重新生成后

    C:UsersAdministrator.m2 epositoryorgapachemavenpluginsmaven-compiler-plugin下的文件带.lastUpdated 说明文件没有下载成功。

    这时需要配置Maven的setting

    打开Maven的安装目录E:WebGISapache-maven-3.6.1-binapache-maven-3.6.1confsettings.xml

    编辑setting.xml文件

      <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>
         -->
         
         <mirror>
                <id>alimaven-central</id>
                <mirrorOf>central</mirrorOf>
                <name>aliyun maven</name>
                <url>http://maven.aliyun.com/nexus/content/repositories/central/</url>
            </mirror>
            <mirror>
                <id>jboss-public-repository-group</id>
                <mirrorOf>central</mirrorOf>
                <name>JBoss Public Repository Group</name>
                <url>http://repository.jboss.org/nexus/content/groups/public</url>
            </mirror>
      </mirrors>

    删除C:UsersAdministrator.m2 epositoryorgapachemavenpluginsmaven-compiler-plugin下的所有文件

    然后右击项目选择【Maven】->【Update Project】

  • 相关阅读:
    git stash 一个场景 mark
    sendBeacon 使用
    【踩坑笔记】layui之单选和复选框不显示
    wordpress后台管理超时没反应:load-scripts.php载入缓慢出错
    MySQL_Sql_打怪升级_进阶篇_测试: SQL随机生成测试数据
    MySQL_Sql_打怪升级_进阶篇_测试: 游标应用
    MySQL8.0新特性_01_JSON数据格式的支持
    MySQL_Sql_打怪升级_进阶篇_进阶19: 函数
    MySQL_Sql_打怪升级_进阶篇_进阶18: 存储过程
    MySQL_Sql_打怪升级_进阶篇_进阶17: 变量
  • 原文地址:https://www.cnblogs.com/huangzhen22/p/10905762.html
Copyright © 2011-2022 走看看