eclipse新建maven项目:'Building' has encountered a problem. Errors occurred during the build.


二、eclipse 新建maven 项目报错(因为没有配置maven环境)

1、问题:

① 出现的问题1:

Could not calculate build plan:Plugin
org.apache.maven.plugins:maven-resources-plugin:2.6 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-resources-plugin:jar:2.6

eclipse新建maven项目:'Building' has encountered a problem. Errors occurred during the build._第1张图片


② 出现的问题2:

'Building' has encountered a problem. Errors occurred during the build.
eclipse新建maven项目:'Building' has encountered a problem. Errors occurred during the build._第2张图片



2、分析问题:

① 错误原因:编译工具eclipse没有配置 maven的环境



3、解决:在eclipse中配置maven的环境

eclipse新建maven项目:'Building' has encountered a problem. Errors occurred during the build._第3张图片



二、补充一下 maven的环境搭建



Maven 环境搭建

一、准备工作:

1、maven下载:官网:https://maven.apache.org/download.cgi

  • 下载完成后解压出来

2、配置环境变量

  • 细节:为什么要单独配置一个M2_HOME 的变量:方便后续学习

    • 后续使用的自动依赖的系统,比如SpringBoot、SpringCloud,它会引用M2_HOME 这个地址。

■ 添加系统变量:

□ M2_HOME maven目录下的bin目录

□ MAVEN_HOME maven的目录

□ 在系统的path中配置 %MAVEN_HOME%\bin

eclipse新建maven项目:'Building' has encountered a problem. Errors occurred during the build._第4张图片 eclipse新建maven项目:'Building' has encountered a problem. Errors occurred during the build._第5张图片

■ 验证maven是否配置成功:查看maven版本的命令 mvn -version

eclipse新建maven项目:'Building' has encountered a problem. Errors occurred during the build._第6张图片

3、修改maven 配置文件的镜像为 阿里云镜像

  • 配置文件位置:maven根目录/conf/settings.xml 找到镜像元素mirrors

  • 镜像:mirrors:

    • 作用:加速下载
    • 默认是使用国外的镜像,国内建议使用阿里云镜像加速下载
       
      
       
            nexus-aliyun
         *,!jeecg,!jeecg-snapshots
            Nexus aliyun
            http://maven.aliyun.com/nexus/content/groups/public
        
    
  
	
        nexus-aliyun
     central
        Nexus aliyun
        http://maven.aliyun.com/nexus/content/groups/public
    

4、修改maven 配置文件的本地仓库位置

  • 修改本地仓库位置为:maven 根目录下 自己手动建立的 maven-repo
  • 配置文件位置:maven根目录/conf/settings.xml 找到 localRepository元素
  E:\environment\mavenEvironment\apache-maven-3.8.2\maven-repo

你可能感兴趣的:(eclipse新建maven项目:'Building' has encountered a problem. Errors occurred during the build.)