新建SpringBoot项目pom.xml报错:maven-compiler-plugin插件依赖错误

 

报错代码:

Multiple annotations found at this line:
	- CoreException: Could not get the value for parameter compilerId for plugin execution default-testCompile: PluginResolutionException: Plugin 
	 org.apache.maven.plugins:maven-compiler-plugin:3.1 or one of its dependencies could not be resolved: Failure to transfer org.codehaus.plexus:plexus-
	 compiler-javac:jar:2.2 from http://maven.aliyun.com/nexus/content/groups/public/ was cached in the local repository, resolution will not be reattempted 
	 until the update interval of alimaven has elapsed or updates are forced. Original error: Could not transfer artifact org.codehaus.plexus:plexus-compiler-
	 javac:jar:2.2 from/to alimaven (http://maven.aliyun.com/nexus/content/groups/public/): Failed to transfer http://maven.aliyun.com/nexus/content/groups/
	 public/org/codehaus/plexus/plexus-compiler-javac/2.2/plexus-compiler-javac-2.2.jar. Error code 302, Found
	- CoreException: Could not get the value for parameter compilerId for plugin execution default-compile: PluginResolutionException: Plugin 
	 org.apache.maven.plugins:maven-compiler-plugin:3.1 or one of its dependencies could not be resolved: Failure to transfer org.codehaus.plexus:plexus-
	 compiler-javac:jar:2.2 from http://maven.aliyun.com/nexus/content/groups/public/ was cached in the local repository, resolution will not be reattempted 
	 until the update interval of alimaven has elapsed or updates are forced. Original error: Could not transfer artifact org.codehaus.plexus:plexus-compiler-
	 javac:jar:2.2 from/to alimaven (http://maven.aliyun.com/nexus/content/groups/public/): Failed to transfer http://maven.aliyun.com/nexus/content/groups/
	 public/org/codehaus/plexus/plexus-compiler-javac/2.2/plexus-compiler-javac-2.2.jar. Error code 302, Found

在本地库查找了maven-compiler-plugin 和plexus-compiler-javac 的jar包版本都存在,查找另外原因:springBoot 集成jar包里面没有指定maven-compiler-plugin 的jdk的版本,所以 需要 添加jdk 版本指定

 
  
  	1.7
  

资料:https://blog.csdn.net/liupeifeng3514/article/details/80236077

maven是个项目管理工具,如果我们不告诉它我们的代码要使用什么样的jdk版本编译的话,它就会用maven-compiler-plugin默认的jdk版本来进行处理,这样就容易出现版本不匹配,以至于可能导致编译不通过的问题。

maven的默认编译使用的jdk版本貌似很低,使用maven-compiler-plugin插件可以指定项目源码的jdk版本,编译后的jdk版本,以及编码。
 

                                                                                                                                      
                                                                               
    org.apache.maven.plugins                                                                                               
    maven-compiler-plugin                                                                                            
    3.1                                                                                                                    
                                                                                                                               
                            
        1.8                                                                                              
        1.8                                                                                      
        UTF-8
        true                                                                             
        true
        true                                                                                                               
        true                                                        
                   
        1.3                                                                         
        128m                                                                                      
        512m                                                                                              
        -verbose -bootclasspath ${java.home}\lib\rt.jar               
                                                                                                                              
                                                                                                                                     

 

你可能感兴趣的:(SpringBoot,Maven)