Java 9模块测试错误

amk*_*mkz 4 java maven java-9

我已经用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
Run Code Online (Sandbox Code Playgroud)

它很奇怪,因为我可以在没有警告或错误的情况下在intellij中运行这个项目,我也可以在这个模块中运行测试而不会出错.

我使用的是oracle站点和Maven 3.5.0的Java 9.对不起,我无法用java9标记它.

Rob*_*lte 6

您应该使用maven-compiler-plugin 3.7.0 3.6.x基于模块类的旧定义,因此在使用Java 9时它们变得毫无用处.