简体   繁体   English

引导层初始化期间发生错误。 plexus.container.default:无效的模块名称:'default' 不是 Java 标识符

[英]Error occurred during initialization of boot layer. plexus.container.default: Invalid module name: 'default' is not a Java identifier

I'm using IntelliJ IDEA 2020.2.3 and maven for my application.我正在为我的应用程序使用 IntelliJ IDEA 2020.2.3 和 maven。

When I'm trying to call maven javafx:run plugin (like every maven plugin), I'm getting such warnings:当我尝试调用 maven javafx:run 插件(就像每个 maven 插件一样)时,我收到了这样的警告:

[WARNING] Can't extract module name from plexus-container-default-1.7.1.jar: plexus.container.default: Invalid module name: 'default' is not a Java identifier [警告] 无法从 plexus-container-default-1.7.1.jar 中提取模块名称:plexus.container.default:无效的模块名称:“默认”不是 Java 标识符

[WARNING] Some dependencies encountered issues while attempting to be resolved as modules and will not be included in the classpath; [警告] 某些依赖项在尝试作为模块解析时遇到问题,不会包含在类路径中; you can change this behavior via the 'includePathExceptionsInClasspath' configuration parameter.您可以通过“includePathExceptionsInClasspath”配置参数更改此行为。

The application works correctly.该应用程序正常工作。

However, when I'm trying to simply run Main class in IDE, I'm getting an error:但是,当我尝试在 IDE 中简单地运行 Main class 时,出现错误:

Error occurred during initialization of boot layer
java.lang.module.FindException: Unable to derive module descriptor for C:\Users\hlebs\.m2\repository\org\codehaus\plexus\plexus-container-default\1.7.1\plexus-container-default-1.7.1.jar
Caused by: java.lang.IllegalArgumentException: plexus.container.default: Invalid module name: 'default' is not a Java identifier

This is my pom.xml:这是我的 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>

I want to run the Main class instead of running javafx:run plugin, because it's a bit longer and harmful for me when I'm testing some features.我想运行 Main class 而不是运行 javafx:run 插件,因为当我测试某些功能时,它对我来说有点长且有害。 Also I think such an error is not a normal situation.另外我认为这样的错误不是正常情况。 What can you advice to try?你有什么建议可以尝试?

After removing the dependency on maven-dependency-plugin the error has disappeared, but now I get other errors, when trying to run Main class:删除对 maven-dependency-plugin 的依赖后,错误消失了,但现在我在尝试运行 Main class 时遇到其他错误:

Build output Printscreen构建 output Printscreen

My module-info.java looks like:我的 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;
}

In the pom.xml I changed在 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>

to

        <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>

In other words, just edited the javafx dependencies version to 16-ea+1.也就是说,只是将 javafx 依赖版本编辑为 16-ea+1。 Now everything works fine.现在一切正常。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 java.lang.IllegalArgumentException: plexus.container.default: 无效的模块名称:&#39;default&#39; 不是 Java 标识符 - java.lang.IllegalArgumentException: plexus.container.default: Invalid module name: 'default' is not a Java identifier 启动层初始化时出错 -java - Error occurred during initialization of boot layer -java 启动层初始化时出错 java.lang.module.FindException: Module SimpleJavaProgram not found - Error occurred during initialization of boot layer java.lang.module.FindException: Module SimpleJavaProgram not found 启动层初始化期间出错。无法导出模块描述符 - Error occurred during initialization of boot layer .Unable to derive module descriptor 启动层初始化时出错 FindException: Module not found - Error occurred during initialization of boot layer FindException: Module not found Java - Ecipe IDE 错误 - 引导层初始化期间发生错误 - Java - Eclipe IDE error - Error occurred during initialization of boot layer 运行 javafx 应用程序 - 启动层初始化期间发生错误:java.lang.module.ResolutionException - Running javafx application - Error occurred during initialization of boot layer: java.lang.module.ResolutionException 为什么 Java 无法运行类 - 启动层初始化期间发生错误 - 未找到模块 mods - Why Java fail to run class- error occurred during initialization of boot layer- Module mods not found 在 VS Code 中为 Java FX 初始化引导层期间发生错误 - Error Occurred During Initialization of Boot Layer for Java FX in VS Code 引导层初始化时出错 - Eclipse Java - Error occurred during initialization of boot layer - Eclipse Java
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM