JDK 11.0.2-无法在ECLIPSE中派生模块描述符 [英] JDK 11.0.2 - Unable to derive module descriptor in ECLIPSE

查看:95
本文介绍了JDK 11.0.2-无法在ECLIPSE中派生模块描述符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试运行其他人制作的项目.我将项目添加到eclipse中,它会自动生成一个module-info.java,并且由于模块是基于名称的,因此我会收到警告,所以我假设这可能是我的问题.我对模块不熟悉,并且很难理解在线上的一些资源.这是我的运行时错误.

I'm trying to run a project someone else made. I added the project to eclipse and it automatically generated a module-info.java and I'm getting warnings because the modules are name based, so I'm assuming this may be my issue. I am not familiar with Modules and I'm having a hard time understanding some of the resources online. Heres my runtime error.

Error occurred during initialization of boot layer
java.lang.module.FindException: Unable to derive module descriptor for C:\Users\under\Desktop\RSPS\Emerald\Server\lib\xpp3.jar
Caused by: java.lang.module.InvalidModuleDescriptorException: Provider class org.xmlpull.mxp1.MXParser,org.xmlpull.mxp1_serializer.MXSerializer not in module

这是我的module-info.java

Here is my module-info.java

/**
  * 
  */
/**
 * @author GameBeast
 *
 */
module server {
exports com.elvarg;
exports com.elvarg.net.packet;
exports com.elvarg.world.model.teleportation;
exports com.elvarg.world.model.dialogue;
exports com.elvarg.util;
exports com.elvarg.world.content.skills.Prayer;
exports com.elvarg.world.content.skills.Herblore;
exports fileserver.net;
exports com.elvarg.world.model.container;
exports fileserver.net.codec;
exports fileserver;
exports com.elvarg.world.entity.combat.method.impl.npcs;
exports com.elvarg.world.entity.impl.npc.bots;
exports com.elvarg.world.entity.impl.npc;
exports com.elvarg.world.collision.buffer;
exports com.elvarg.world.content;
exports com.elvarg.world.model.container.impl;
exports com.elvarg.net.login;
exports com.elvarg.net.security;
exports com.elvarg.world.model.equipment;
exports fileserver.cache;
exports com.elvarg.world.model.syntax;
exports com.elvarg.world.entity.combat;
exports com.elvarg.world.entity.impl;
exports com.elvarg.engine;
exports com.elvarg.world.grounditems;
exports com.elvarg.world.entity.combat.method.impl.specials;
exports com.elvarg.world.entity.combat.magic;
exports com.elvarg.net.channel;
exports com.elvarg.net.packet.impl;
exports com.elvarg.net.codec;
exports com.elvarg.definitions;
exports com.elvarg.world.entity.combat.ranged;
exports com.elvarg.world.entity.combat.method;
exports com.elvarg.world.content.clan;
exports com.elvarg.world.entity.impl.player;
exports com.elvarg.engine.task;
exports com.elvarg.world.entity.combat.method.impl;
exports com.elvarg.engine.task.impl;
exports com.elvarg.world.entity.updating;
exports com.elvarg.world.entity.impl.npc.bots.impl;
exports com.elvarg.world.entity;
exports com.elvarg.world.entity.combat.hit;
exports com.elvarg.world.model.syntax.impl;
exports com.elvarg.world.collision.region;
exports com.elvarg.world.entity.impl.object;
exports com.elvarg.world.entity.combat.bountyhunter;
exports com.elvarg.net;
exports com.elvarg.world.entity.combat.formula;
exports com.elvarg.world.model.movement.path;
exports com.elvarg.world.model;
exports com.elvarg.world.model.movement;
exports com.elvarg.world;

requires bzip2;
requires gson;
requires guava;
requires java.logging;
requires java.management;
requires netty.all;
requires xpp3;  
}

我的jar文件(重命名为xpp3,因为stackoverflow上的资源表示文件名的语法可能是一个问题)包含错误指出不是模块的文件,

My jar file (renamed to xpp3 because a resource on stackoverflow said the syntax of the file name could be an issue) contains the files that the error says isn't a module,

org.xmlpull.mxp1.MXParser,org.xmlpull.mxp1_serializer.MXSerializer

所以我的问题是如何使用eclipse将它们添加到模块中?

So my question is how do I add these to the module using eclipse?

另外,关于stackoverflow的另一篇文章说要确保配置了构建路径,以使我的库位于模块路径而不是类路径中,我也确保这样做. https://prnt.sc/owu9r3

Also, another post on stackoverflow said to make sure the build path was configured so that my libs were in my modulepath not my classpath, I made sure to do this as well. https://prnt.sc/owu9r3

我已经尝试解决了几个小时,非常感谢您的帮助.

I've been trying to figure this out for hours now, any help is greatly appreciated.

推荐答案

似乎 JAR文件包含提供者配置文件 META-INF/services/org.xmlpull.v1.XmlPullParserFactory ,其内容如下:

The JAR file contains the provider-configuration file META-INF/services/org.xmlpull.v1.XmlPullParserFactory with the following content:

org.xmlpull.mxp1.MXParser,org.xmlpull.mxp1_serializer.MXSerializer

这两个提供程序类被指定为逗号分隔的列表,而不是每行一个类.请参见 ServiceLoader的Javadoc (以粗体显示)由我):

The two provider classes are specified as comma-separated list instead of one class per line. See Javadoc of ServiceLoader (highlighting in bold by me):

该文件包含混凝土的全限定二进制名称列表提供商类,每行一个.

另请参见错误消息:它表示提供商类,而不是提供商类,并且后没有空格,,因此它仅使用无效名称命名单个类. org.xmlpull.mxp1.MXParser,org.xmlpull.mxp1_serializer.MXSerializer

See also the error message: it says Provider class and not Provider classes and there is no space after the , so it names only the single class with the invalid name org.xmlpull.mxp1.MXParser,org.xmlpull.mxp1_serializer.MXSerializer.

关于模块描述符的误导性错误消息表示 module-info.java 文件指定的https://openjdk.java.net/projects/jigsaw/quick-start#services"rel =" nofollow noreferrer> JPMS服务(自Java 9起可用).这可能会导致在Java 9及更高版本中发生的错误在Java 8及更低版本中未发生,或者在较早的时间点(在启动应用程序时而不是在使用应用程序时)发生了错误.

The misleading error message talking about a module descriptor implies that the implementation of services specified via META-INF/services/* files (available since Java 6), has been merged with the new implementation of JPMS services specified via the module-info.java file (which are available since Java 9). This might result that in Java 9 and higher errors occur that did not occur in Java 8 and lower or that an error occurs at an earlier point in time (already when starting the application instead of when using it).

这篇关于JDK 11.0.2-无法在ECLIPSE中派生模块描述符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆