错误现象:

Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project cjj: Compilation failure -> [Help 1]

报错:Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1_Java报错:Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1_Java_02

官方帮助文档:

Unlike many other errors, this exception is not generated by the Maven core itself but by a plugin. As a rule of thumb, plugins use this error to signal a failure of the build because there is something wrong with the dependencies or sources of a project, e.g. a compilation or a test failure.

The concrete meaning of the exception depends on the plugin so please have a look at its documentation. The documentation for many common Maven plugins can be reached via our plugin index.

翻译:

与许多其他错误不同,此异常不是由Maven核心本身生成的,而是由插件生成的。 根据经验,插件使用此错误来表示构建失败,因为项目的依赖项或源代码存在问题,例如: 编译或测试失败。

异常的具体含义取决于插件,所以请查看其文档。 可以通过我们的插件索引访问许多常见Maven插件的文档。

解决:

在我遇到的情况下,是这样解决的,更换jdk的版本号即可。

报错:Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1_Java_03报错:Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1_Java_04

如果不行,加上下买呢内容:

         <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.6.1</version>
                    <configuration>
                        <source>1.6</source>
                        <target>1.6</target>
                    </configuration>
                </plugin>