org.apache.maven.plugin.compiler.CompilationFailureException: Compilation failure


[DEBUG] incrementalBuildHelper#afterRebuildExecution
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR : 
[INFO] -------------------------------------------------------------
[ERROR] /D:/git/springboot_mybatisplus/src/main/java/io/z77z/tio/server/BarrageServerStarter.java:[19,140] -source 1.6 中不支持 diamond 运算符
  (请使用 -source 7 或更高版本以启用 diamond 运算符)
[ERROR] /D:/git/springboot_mybatisplus/src/main/java/io/z77z/tio/server/HttpRequestDecoder.java:[40,59] -source 1.6 中不支持 diamond 运算符
  (请使用 -source 7 或更高版本以启用 diamond 运算符)
[ERROR] /D:/git/springboot_mybatisplus/src/main/java/io/z77z/tio/server/WebsocketPacket.java:[36,74] -source 1.6 中不支持 diamond 运算符
  (请使用 -source 7 或更高版本以启用 diamond 运算符)
[ERROR] /D:/git/springboot_mybatisplus/src/main/java/io/z77z/tio/server/BarrageServerHandler.java:[22,82] -source 1.6 中不支持 diamond 运算符
  (请使用 -source 7 或更高版本以启用 diamond 运算符)
[ERROR] /D:/git/springboot_mybatisplus/src/main/java/io/z77z/tio/handlers/HandshakeReqHandler.java:[70,71] -source 1.6 中不支持 diamond 运算符
  (请使用 -source 7 或更高版本以启用 diamond 运算符)
[INFO] 5 errors 
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.880 s
[INFO] Finished at: 2017-09-22T15:29:49+08:00
[GC (System.gc())  35046K->22751K(336896K), 0.0137723 secs]
[Full GC (System.gc())  22751K->20475K(336896K), 0.0968946 secs]
[INFO] Final Memory: 24M/329M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project mybatisplus-spring-boot: Compilation failure: Compilation failure:
[ERROR] /D:/git/springboot_mybatisplus/src/main/java/io/z77z/tio/server/BarrageServerStarter.java:[19,140] -source 1.6 中不支持 diamond 运算符
[ERROR] (请使用 -source 7 或更高版本以启用 diamond 运算符)
[ERROR] /D:/git/springboot_mybatisplus/src/main/java/io/z77z/tio/server/HttpRequestDecoder.java:[40,59] -source 1.6 中不支持 diamond 运算符
[ERROR] (请使用 -source 7 或更高版本以启用 diamond 运算符)
[ERROR] /D:/git/springboot_mybatisplus/src/main/java/io/z77z/tio/server/WebsocketPacket.java:[36,74] -source 1.6 中不支持 diamond 运算符
[ERROR] (请使用 -source 7 或更高版本以启用 diamond 运算符)
[ERROR] /D:/git/springboot_mybatisplus/src/main/java/io/z77z/tio/server/BarrageServerHandler.java:[22,82] -source 1.6 中不支持 diamond 运算符
[ERROR] (请使用 -source 7 或更高版本以启用 diamond 运算符)
[ERROR] /D:/git/springboot_mybatisplus/src/main/java/io/z77z/tio/handlers/HandshakeReqHandler.java:[70,71] -source 1.6 中不支持 diamond 运算符
[ERROR] (请使用 -source 7 或更高版本以启用 diamond 运算符)
[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project mybatisplus-spring-boot: Compilation failure
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.compiler.CompilationFailureException: Compilation failure
    at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:858)
    at org.apache.maven.plugin.compiler.CompilerMojo.execute(CompilerMojo.java:129)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
    ... 20 more
[ERROR] 
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

大致的问题就是编译的时候JDK用的1.6  版本低导致

解决方案

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

1.7 JDK的版本号


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM