启动层初始化期间出错。plexus.container.default:模块名称无效:'default'不是 Java 标识符



我使用IntelliJ IDEA 2020.2.3和maven为我的应用程序。

当我试图调用maven javafx:run plugin(像每个maven插件一样)时,我得到这样的警告:

[WARNING]不能提取模块名plexus.container.default:无效模块名:'default'不是Java标识符

[警告]一些依赖关系遇到问题时,试图解析为模块,不会包含在类路径中;你可以通过' includepatheexceptionsinasspath '更改此行为配置参数。

应用程序工作正常

然而,当我试图在IDE中简单地运行Main类时,我得到一个错误:

Error occurred during initialization of boot layer
java.lang.module.FindException: Unable to derive module descriptor for C:Usershlebs.m2repositoryorgcodehausplexusplexus-container-default1.7.1plexus-container-default-1.7.1.jar
Caused by: java.lang.IllegalArgumentException: plexus.container.default: Invalid module name: 'default' is not a Java identifier
这是我的pom.xml:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.openjfx</groupId>
<artifactId>javafx-app</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>15.0.1</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-fxml</artifactId>
<version>15.0.1</version>
</dependency>
<dependency>
<groupId>org.kordamp.ikonli</groupId>
<artifactId>ikonli-javafx</artifactId>
<version>12.2.0</version>
</dependency>
<dependency>
<groupId>org.kordamp.ikonli</groupId>
<artifactId>ikonli-remixicon-pack</artifactId>
<version>12.2.0</version>
</dependency>
<dependency>
<groupId>org.kordamp.ikonli</groupId>
<artifactId>ikonli-fontawesome-pack</artifactId>
<version>12.2.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.postgresql/postgresql -->
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.2.18</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-dependency-plugin -->
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.1.2</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<release>11</release>
</configuration>
</plugin>
<plugin>
<groupId>org.openjfx</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<version>0.0.4</version>
<configuration>
<mainClass>org.openjfx.Launcher</mainClass>
</configuration>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<mainClass>org.openjfx.Launcher</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.4</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<manifestEntries>
<Main-Class>org.openjfx.Launcher</Main-Class>
<Build-Number>123</Build-Number>
</manifestEntries>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>prepare-package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>
${project.build.directory}/libs
</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.4</version>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<classpathPrefix>libs/</classpathPrefix>
<mainClass>
org.openjfx.Launcher
</mainClass>
</manifest>
<manifestEntries>
<Automatic-Module-Name>assertj-core</Automatic-Module-Name>
</manifestEntries>
</archive>
</configuration>
</plugin>
</plugins>
</build>
</project>

我想运行Main类而不是运行javafx:run插件,因为当我测试一些功能时,它对我来说有点长而且有害。我也认为这样的错误是不正常的情况。你有什么建议可以试试吗?

在删除maven-dependency-plugin的依赖后,错误已经消失,但现在我得到其他错误,当试图运行Main类:

构建输出Printscreen

module-info.java如下:

module org.openjfx {
requires javafx.controls;
requires javafx.fxml;
requires org.kordamp.ikonli.core;
requires org.kordamp.ikonli.javafx;
requires org.kordamp.ikonli.fontawesome;
requires org.kordamp.ikonli.remixicon;
requires java.sql;
requires java.desktop;
opens org.openjfx to javafx.fxml;
opens org.openjfx.ledicom.entities to javafx.base;
opens org.openjfx.ledicom.controllers.employee to javafx.fxml;
opens org.openjfx.ledicom.controllers.notifications to javafx.fxml;
opens org.openjfx.ledicom.controllers to javafx.fxml;
exports org.openjfx.ledicom.entities to java.sql;
exports org.openjfx;
}

在pom.xml中我更改了

<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>15.0.1</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-fxml</artifactId>
<version>15.0.1</version>
</dependency>

<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>16-ea+1</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-fxml</artifactId>
<version>16-ea+1</version>
</dependency>

换句话说,只是将javafx依赖版本编辑为16-ea+1。现在一切正常。

相关内容

最新更新