为什么我的罐子没有MC龙头遮阳



所以我正在尝试编写一个mc插件,并使用一个名为Reflections的外部mavin库。问题是当我加载插件时,它会吐出一个错误,说它找不到Reflections类。我查看了其他类似的论坛,并尝试了他们使用mavins shade插件和编辑pom.xml文件所说的内容,但它并没有对反射进行阴影处理。这就是我目前在pom.xml中的内容:

<dependencies>
<dependency>
<groupId>org.reflections</groupId>
<artifactId>reflections</artifactId>
<version>0.9.12</version>
</dependency>
</dependencies>
<properties>
<maven.compiler.source>16</maven.compiler.source>
<maven.compiler.target>16</maven.compiler.target>
</properties>
<build>
<plugins>
<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>
<minimizeJar>true</minimizeJar>
<createDependencyReducedPom>false</createDependencyReducedPom>
<artifactSet>
<includes>
<include>org.reflections</include>
<include>org.reflections:*</include>
</includes>
</artifactSet>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

此代码有问题吗?我从未使用过xml,只有一点xaml的经验。有什么想法吗?如果有人需要,我可以发布错误代码

如果您正在使用Eclipse,请在Package Explorer中右键单击您的项目,然后转到Run As->Maven构建。。。

在标记为目标:的文本框中新打开的窗口中,键入package shade:shade(如下图所示:屏幕截图(,然后单击运行。这将在eclipse的控制台(BUILD SUCCESS消息上方(中打印文件夹中的带有阴影库的plugin.jar文件。这也将创建一个运行配置,您以后可以在不重复该过程的情况下使用该配置。

注意,以这种方式编译时,您可能还需要在pom.xml中添加Spigot作为依赖项。有关进一步的说明,请参阅本文。

最新更新