Java 9个模块测试错误

Java 9 modules test error

我已经用 Maven 编写了 Java 9 模块应用程序,现在我正在尝试添加测试用例。

我在尝试对整个项目 mvn clean install 时出现此错误:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.6.1:testCompile (default-testCompile) on project EmployeeModule: Fatal error compiling: invalid flag: -Xmodule:EmployeeModule -> [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/MojoExecutionException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR]   mvn <goals> -rf :EmployeeModule

这很奇怪,因为我可以在 intellij 中 运行 这个项目而不会出现警告或错误,我也可以 运行 在这个模块中进行测试而不会出现错误。

我正在使用来自 oracle 站点的 Java 9 和 Maven 3.5.0。 抱歉,我无法用 java9 标记它。

你应该使用 maven-compiler-plugin 3.7.0 3.6.x 基于模块的旧定义-class,因此在使用 Java 9.

时它们变得无用了