Maven报错:“请使用 -source 7 或更高版本以启用 diamond 运算符”
[INFO] Scanning for projects... [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building storm-kafka-test 1.0-SNAPSHOT [INFO] ------------------------------------------------------------------------ [INFO] [INFO] >>> maven-assembly-plugin:2.2-beta-5:assembly (default-cli) > package @ storm-samples >>> [INFO] [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ storm-samples --- [WARNING] Using platform encoding (GBK actually) to copy filtered resources, i.e. build is platform dependent! [INFO] skip non existing resourceDirectory E:\eclipse\workspace\Copy_storm-kafka-test\src\main\resources [INFO] [INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ storm-samples --- [INFO] Changes detected - recompiling the module! [WARNING] File encoding has not been set, using platform encoding GBK, i.e. build is platform dependent! [INFO] Compiling 5 source files to E:\eclipse\workspace\Copy_storm-kafka-test\target\classes [INFO] ------------------------------------------------------------- [ERROR] COMPILATION ERROR : [INFO] ------------------------------------------------------------- [ERROR] /E:/eclipse/workspace/Copy_storm-kafka-test/src/main/java/com/h3c/storm/PrivateHBaseBolt.java:[30,46] -source 1.5 中不支持 diamond 运算符 (请使用 -source 7 或更高版本以启用 diamond 运算符) [INFO] 1 error [INFO] ------------------------------------------------------------- [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 5.976 s [INFO] Finished at: 2016-07-08T10:57:52+08:00 [INFO] Final Memory: 14M/159M [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project storm-samples: Compilation failure [ERROR] /E:/eclipse/workspace/Copy_storm-kafka-test/src/main/java/com/h3c/storm/PrivateHBaseBolt.java:[30,46] -source 1.5 中不支持 diamond 运算符 [ERROR] (请使用 -source 7 或更高版本以启用 diamond 运算符) [ERROR] -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [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
编译版本出现了问题,在pom文件作如下修改
<plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <configuration> <source>1.7</source> <target>1.7</target> </configuration> </plugin> </plugins>