我正在使用 BuildTools 构建 spigot 的 kotlin 分支,buildtool 的 spigot 模块中的 maven shade 插件抛出错误
[INFO] --- maven-shade-plugin:2.3:shade (default) @ spigot ---
[INFO] Including net.sf.trove4j:trove4j:jar:3.0.3 in the shaded jar.
[INFO] Including org.spigotmc:spigot-api:jar:1.8.8-R0.1-SNAPSHOT in the shaded jar.
[INFO] Including org.jetbrains.kotlin:kotlin-stdlib-jdk8:jar:1.8.20-RC in the shaded jar.
[INFO] Including org.jetbrains.kotlin:kotlin-stdlib:jar:1.8.20-RC in the shaded jar.
[INFO] Including org.jetbrains.kotlin:kotlin-stdlib-common:jar:1.8.20-RC in the shaded jar.
[INFO] Including org.jetbrains:annotations:jar:13.0 in the shaded jar.
[INFO] Including org.jetbrains.kotlin:kotlin-stdlib-jdk7:jar:1.8.20-RC in the shaded jar.
[INFO] Including commons-lang:commons-lang:jar:2.6 in the shaded jar.
[INFO] Including com.googlecode.json-simple:json-simple:jar:1.1.1 in the shaded jar.
[INFO] Including com.google.code.gson:gson:jar:2.2.4 in the shaded jar.
[INFO] Including org.avaje:ebean:jar:2.8.1 in the shaded jar.
[INFO] Including javax.persistence:persistence-api:jar:1.0 in the shaded jar.
[INFO] Including org.yaml:snakeyaml:jar:1.15 in the shaded jar.
[INFO] Including net.md-5:bungeecord-chat:jar:1.8-SNAPSHOT in the shaded jar.
[INFO] Including org.apache.logging.log4j:log4j-core:jar:2.8.1 in the shaded jar.
[INFO] Including org.apache.logging.log4j:log4j-api:jar:2.8.1 in the shaded jar.
[INFO] Including org.spigotmc:minecraft-server:jar:1.8.8-SNAPSHOT in the shaded jar.
[INFO] Including net.sf.jopt-simple:jopt-simple:jar:3.2 in the shaded jar.
[INFO] Including jline:jline:jar:2.12 in the shaded jar.
[INFO] Including org.xerial:sqlite-jdbc:jar:3.7.2 in the shaded jar.
[INFO] Including mysql:mysql-connector-java:jar:5.1.14 in the shaded jar.
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] Spigot-API 1.8.8-R0.1-SNAPSHOT ..................... SUCCESS [ 23.217 s]
[INFO] Spigot-Parent dev-SNAPSHOT ......................... SUCCESS [ 0.320 s]
[INFO] Spigot 1.8.8-R0.1-SNAPSHOT ......................... FAILURE [ 23.781 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 47.459 s
[INFO] Finished at: 2023-03-28T18:48:47-07:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-shade-plugin:2.3:shade (default) on project spigot: Error creating shaded jar: null: IllegalArgumentException -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <args> -rf :spigot
同时尝试将 stdlib 隐藏到罐子中。这不会发生在任何其他依赖项上,只有 kotlin stdlib。这是maven shade插件的配置
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.3.0</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<relocations>
<relocation>
<pattern>joptsimple</pattern>
<shadedPattern>org.bukkit.craftbukkit.libs.joptsimple</shadedPattern>
</relocation>
<relocation>
<pattern>jline</pattern>
<shadedPattern>org.bukkit.craftbukkit.libs.jline</shadedPattern>
</relocation>
<relocation>
<pattern>org.ibex</pattern>
<shadedPattern>org.bukkit.craftbukkit.libs.org.ibex</shadedPattern>
</relocation>
<relocation>
<pattern>org.gjt</pattern>
<shadedPattern>org.bukkit.craftbukkit.libs.org.gjt</shadedPattern>
</relocation>
<relocation>
<pattern>org.bukkit.craftbukkit</pattern>
<shadedPattern>org.bukkit.craftbukkit.v${minecraft_version}</shadedPattern>
<excludes>
<exclude>org.bukkit.craftbukkit.Main*</exclude>
</excludes>
</relocation>
<relocation>
<pattern>net.minecraft.server</pattern>
<shadedPattern>net.minecraft.server.v${minecraft_version}</shadedPattern>
</relocation>
</relocations>
</configuration>
</execution>
</executions>
</plugin>
请注意,该插件是旧版本,因为我正在分叉 spigot 1.8.8