Maven创建SpringBoot2.0 及以下版本 parent标签报错或者头信息报错解决

注:为了演示错误所以上下文出现的spring-boot-starter-parent版本不一致

报错信息1:

  parent标签报错:

  Project build error: Non-resolvable parent POM: Failure to find org.springframework.boot:spring-boot-starter-parent:pom:2.0.0.RELEASE in http://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 and 'parent.relativePath' points at wrong local POM
解决方式:

  是因为中央仓库找不到父类POM路径的问题,百度到的解决方案是:

  将中央仓库设置为阿里云-清空本地仓库-Update project或者是设置../../pom.xml

  但是发现设置后还是无效,本地仓库下载下来的文件是:spring-boot-starter-parent-1.6.4.RELEASE.pom.lastUpdated(错误的如图:)

Maven创建SpringBoot2.0 及以下版本 parent标签报错或者头信息报错解决_第1张图片

 

 

  最后发现无需修改任何东西,一直删除本地仓库的残留错误的文件-》UpdatePoject即可(看运气,可能是因为你的网络不好或者是因为各种外在原因)直到在本地仓库如图的文件即代表第一个错误解决(接下来就会出现错误信息2):

Maven创建SpringBoot2.0 及以下版本 parent标签报错或者头信息报错解决_第2张图片

 

报错信息2:


pom文件头信息报错

org.apache.maven.archiver.MavenArchiver.getManifest(org.apache.maven.project.MavenProject,
 org.apache.maven.archiver.MavenArchiveConfiguration)
(这个错最坑,会导致所有正常的maven项目报错,导致我重装了Myeclipse)

解决方式:
 
百度到的解决方式是:

Maven创建SpringBoot2.0 及以下版本 parent标签报错或者头信息报错解决_第3张图片

  百度说,原因是自己的Maven配置文件不是最新的,按照步骤操作下来后导致所有maven错误...由于是新手的问题,重装了MyEclipse

解决步骤:

1.将自己的spring-boot-starter-parent版本由2.0.0.RELEASE降至1.5.9RELEASE(注 意在第一步的时候从中央仓库下载的版本就得是1.5.9RELEASE)然后parent标签配置如下:


 org.springframework.boot
 spring-boot-starter-parent
 1.5.9.RELEASE
 


2.将pom中的dependencies里这样配置:


       
            org.springframework.boot
            spring-boot-starter-web
       

       
            org.springframework.boot
            spring-boot-starter-test
            test
       

   

一定要添加第二个!不然会报别的错

 

总结:将正确的文件下载到本地仓库->降低版本->添加spring-boot-starter-test

百度出来的解决方案不一定全部适合自己,不要一昧的按步骤操作,要理解这么做是为什么
如果还是解决不了+我QQ:812130200 我来远程给你解决
如果觉得解决方法有用请评论下有用哦!谢谢
-----------------------------------------------------------------分割线-----------------------------------------------------------------------

SpringBoot2.0报错解决:

jar包的下载还是要多重复下载,直到下载到正确的Jar,上面有步骤
首先,先装一个MyEclipse2017(和主要问题没有关系,但是为了排除jdk等版本太低问题,导致的一系列未知错误,建议2017版本)

Pom.xml:

    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    4.0.0
    team.haier.zza
    Springboot-Jsp-Test
    0.0.1-SNAPSHOT
    war
    
        org.springframework.boot
        spring-boot-starter-parent
        2.0.0.RELEASE
    

    
        UTF-8
        UTF-8
        1.8
    

    
        
        
            org.springframework.boot
            spring-boot-starter-web
        

        
            org.springframework.boot
            spring-boot-starter-test
            test
        

        
        
            org.apache.tomcat.embed
            tomcat-embed-jasper
        

        
        
            org.springframework.boot
            spring-boot-starter-log4j2
            2.0.4.RELEASE
        

        
        
            org.springframework.boot
            spring-boot-starter-aop
        

        
        
            org.springframework.boot
            spring-boot-starter-web
        

        
            mysql
            mysql-connector-java
            runtime
        

        
        
            org.mybatis.spring.boot
            mybatis-spring-boot-starter
            1.1.1
        

        
        
            javax.servlet
            servlet-api
            3.0-alpha-1
            provided
        

        
            javax.servlet
            jstl
            1.2
        

        
            javax.servlet
            javax.servlet-api
            3.1.0
            provided
        

    

    
    
        
            
                maven-compiler-plugin
                2.3.2
                
                    1.8
                    1.8
                

            

            
                maven-war-plugin
                2.2
                
                    3.0
                    false
                

            

            
                org.springframework.boot
                spring-boot-maven-plugin
            

        
    

 

 



 

你可能感兴趣的:(错误解决)