我使用jitpack获取一个github存储库作为依赖项,然后使用maven shade在项目的编译输出中包含所述依赖项。但是,依赖关系中的3个类中只有2个被着色到最终的jar中。似乎没有编译问题(语法或maven),但是在运行时丢失的类会导致抛出noclassdeffounderror。反编译jar显示configmanager和utils被着色,但logger被忽略。
附属国:https://github.com/benlewis9000/plugintoolsapi
pom项目:
<?xml version="1.0" encoding="UTF-8"?>
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.github.benlewis9000</groupId>
<artifactId>PluginToolsAPITestPlugin</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
<repositories>
<!-- This adds the Spigot Maven repository to the build -->
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
<!-- Access github repositories -->
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
<dependencies>
<!--This adds the Spigot API artifact to the build -->
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.13.2-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.github.Benlewis9000</groupId>
<artifactId>PluginToolsAPI</artifactId>
<version>82aaa66bbf</version>
<scope>compile</scope>
</dependency>
</dependencies>
<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>false</minimizeJar>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
请让我知道如果任何信息是缺乏的,谢谢
1条答案
按热度按时间uqxowvwt1#
我不知道jitpack,它看起来确实很有用!
我以前在shade中使用过这个配置: