【问题标题】:Java 9 modules test errorJava 9 模块测试错误
【发布时间】:2018-03-10 12:31:07
【问题描述】:

我已经用 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 标记它。

【问题讨论】:

    标签: java maven java-9


    【解决方案1】:

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

    【讨论】:

    • 这太容易了 :D 谢谢!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-04-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多