问题1.右击项目 run as 选第二个 maven and build ....
报错:
解决方式:
修改一下jdk里面的配置
问题2:
CoreException: Could not get the value for parameter compilerId for plugin execution default-testCompile: TypeNotPresentException: Type org.apache.maven.plugin.compiler.TestCompilerMojo not present: UnsupportedClassVersionError: org/apache/maven/plugin/compiler/TestCompilerMojo : Unsupported major.minor version 51.0
CoreException: Could not get the value for parameter compilerId for plugin execution default-compile: TypeNotPresentException: Type org.apache.maven.plugin.compiler.CompilerMojo not present: UnsupportedClassVersionError: org/apache/maven/plugin/compiler/CompilerMojo : Unsupported major.minor version 51.0
Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-compiler-plugin:3.7.0:compile (execution: default-compile, phase: compile)
原因好像是因为插件版本冲突导致的,具体因为什么也不知道,百度之后找到解决方案:
1.进入Window—>Preferences—>Maven配置,进入Lifecycle Mapping设置项、
找到这个路径的这个文件,到工程的目录下发现没有这个文件,创建一个这个文件lifecycle-mapping-metadata.xml 内容如下:因为我的报错是少了testCompile和compile所以配置里面只加了这个两个
1.进入Window—>Preferences—>Maven配置,进入Lifecycle Mapping设置项
找到这个路径的这个文件,到工程的目录下发现没有这个文件,创建一个这个文件lifecycle-mapping-metadata.xml 内容如下:
<?xml version="1.0" encoding="UTF-8"?>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<goals>
<goal>testCompile</goal>
<goal>compile</goal>
</goals>
<versionRange>[1.4,)</versionRange>
</pluginExecutionFilter>
<action>
<ignore />
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
2.还是进入Window—>Preferences—>Maven配置,进入Lifecycle Mapping设置项
点击:Reload workspace......
3.并且设置 :
如果没有上图选项,需要先重启一下eclipse然后右击项目,maven--->update project....
4.重启eclipse 报错就消失了
问题3.java.lang.TypeNotPresentException: Type org.apache.maven.plugin.compiler.CompilerMojo not present
由于JDK版本为1.6 修改成1,7 并且导入1.7的JRE就好了