且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

使用Java 9时无法执行maven-compiler-plugin:3.6.1:testCompile

更新时间:2022-06-12 00:38:48

简而言之,添加一个名为module-info.java的丢失/放错位置的类,以将项目的模块声明包含在项目的源根目录中. (例如src/main/java)

In short, add a missing/misplaced class named module-info.java to include your project's module declaration at your project's source root. (e.g src/main/java)

此外,请注意升级到版本3.7.0 (如果您有 注释)中的您的module-info. [日志似乎与此有关.]

Additionally, note to upgrade to the version 3.7.0 of the maven-compiler-plugin in case you have a comment included in your module-info class. [The logs seems pretty relevant to this.]

或者,如果您希望使用Java的早期版本编译项目,请使用

Or the other way, if you wish to compile your project with a previous version of Java then use the release flag as:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <version>3.7.0</version>
    <configuration>
        <release>8</release>
        <verbose>true</verbose>
    </configuration>
</plugin>


概念

使用Java9标记项目的完成拼图,其中引入了 Java平台模块系统(JPMS),基于Java版本9及更高版本的项目将被模块化.这将包括一个名为module-info.class的主要编译类,即模块的声明.


Concepts

With Java9 marking the completion of the project Jigsaw therein introducing the Java Platform Module System (JPMS), projects build on Java version 9 and above would be modularised. This would include a primary compiled class called module-info.class which is that module's declaration.

初始草案,最后是模块系统的状态最能说明所遵循和实践的概念.>


The initial draft and eventually The State of the Module System describes best over the concepts followed and practiced.

使Eclipse Oxygen当前版本成为一个额外的技巧 与Java 9兼容

An additional trick regard making Eclipse Oxygen current version compatible with Java 9

AFAIK 最新的氧气生成器(此时为Oxygen.2) 来自Eclipse的目的是要与Java9兼容,而不再需要任何其他插件支持.

AFAIK the latest Oxygen builds (Oxygen.2 at this point in time) from Eclipse are meant to be Java9 compatible without any additional plugin support anymore.