我使用的是JDK 8,因为当我使用 mvn --version 时,它会给出:
Apache Maven 3.2.5 (12a6b3acb947671f09b81f49094c53f426d8cea1; 2014-12-14T22:29:23+05:00)
Maven home: /usr/local/apache-maven-3.2.5
Java version: 1.8.0_11, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-8-oracle/jre
Default locale: en_US, platform encoding: UTF-8
操作系统名称:“linux”,版本:“3.13.0-32-generic”,arch:“amd64”,family:“unix”
为什么它对我说:
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.598 s
[INFO] Finished at: 2015-03-05T16:58:05+05:00
[INFO] Final Memory: 11M/88M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler- plugin:3.1:compile (default-compile) on project string-format- validators: Compilation failure
[ERROR] /home/affan/Development/NetBeansProjects/reference-artifacts-repository/javase/string-format-validators/src/main/java/str/frmt/validators/FactoryInterface.java:[7,37] static interface methods are not supported in -source 1.5
[ERROR] (use -source 8 or higher to enable static interface methods)
[ERROR] -> [Help 1]
当我使用 mvn test
运行测试时答案 0 :(得分:1)
看起来您手动将某个模块的Java版本设置为7 。查看所有maven编译器插件配置。