[SPIGOT-6533] Remapped classes using the specialsource-maven-plugin are not loading Created: 12/Jun/21 Updated: 13/Jun/21 Resolved: 12/Jun/21 |
|
| Status: | Resolved |
| Project: | Spigot |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Minor |
| Reporter: | David Maes | Assignee: | Unassigned |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Version: | [21:51:52] [Server thread/INFO]: This server is running CraftBukkit version 3124-Spigot-66f9d3c-384e116 (MC: 1.17) (Implementing API version 1.17-R0.1-SNAPSHOT) [21:51:52] [Server thread/INFO]: You are running the latest version |
| Guidelines Read: | Yes |
| Description |
|
Hello, I am trying to use the new remapped-mojang jar as a dependency. This works just fine and everything compiles. I package my jar using the specialsource maven plugin to obfuscate the code once again. <plugin> <groupId>net.md-5</groupId> <artifactId>specialsource-maven-plugin</artifactId> <version>1.2.2</version> <executions> <execution> <phase>package</phase> <goals> <goal>remap</goal> </goals> <id>remap-obf</id> <configuration> <srgIn>org.spigotmc:minecraft-server:1.17-R0.1-SNAPSHOT:txt:maps-mojang</srgIn> <reverse>true</reverse> <remappedDependencies>org.spigotmc:spigot:1.17-R0.1-SNAPSHOT:jar:remapped-mojang</remappedDependencies> <remappedArtifactAttached>true</remappedArtifactAttached> <remappedClassifierName>remapped-obf</remappedClassifierName> </configuration> </execution> <execution> <phase>package</phase> <goals> <goal>remap</goal> </goals> <id>remap-spigot</id> <configuration> <inputFile>${project.build.directory}/${project.artifactId}-${project.version}-remapped-obf.jar</inputFile> <srgIn>org.spigotmc:minecraft-server:1.17-R0.1-SNAPSHOT:csrg:maps-spigot</srgIn> <remappedDependencies>org.spigotmc:spigot:1.17-R0.1-SNAPSHOT:jar:remapped-obf</remappedDependencies> </configuration> </execution> </executions> </plugin> This generates my remapped jar. This all works fine. However when running my plugin I get following error upon instantiating a class using the obfuscated classes:
java.lang.NoClassDefFoundError: os
at net.shortninja.staffplus.core.StaffPlus.enable(StaffPlus.java:39) ~[?:?]
at be.garagepoort.mcioc.TubingPlugin.onEnable(TubingPlugin.java:16) ~[?:?]
at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:263) ~[spigot-1.17.jar:3124-Spigot-66f9d3c-384e116]
at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:342) ~[spigot-1.17.jar:3124-Spigot-66f9d3c-384e116]
at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:480) ~[spigot-1.17.jar:3124-Spigot-66f9d3c-384e116]
at org.bukkit.craftbukkit.v1_17_R1.CraftServer.enablePlugin(CraftServer.java:495) ~[spigot-1.17.jar:3124-Spigot-66f9d3c-384e116]
at org.bukkit.craftbukkit.v1_17_R1.CraftServer.enablePlugins(CraftServer.java:409) ~[spigot-1.17.jar:3124-Spigot-66f9d3c-384e116]
at net.minecraft.server.MinecraftServer.loadWorld(MinecraftServer.java:607) ~[spigot-1.17.jar:3124-Spigot-66f9d3c-384e116]
at net.minecraft.server.dedicated.DedicatedServer.init(DedicatedServer.java:264) ~[spigot-1.17.jar:3124-Spigot-66f9d3c-384e116]
at net.minecraft.server.MinecraftServer.x(MinecraftServer.java:986) ~[spigot-1.17.jar:3124-Spigot-66f9d3c-384e116]
at net.minecraft.server.MinecraftServer.lambda$0(MinecraftServer.java:307) ~[spigot-1.17.jar:3124-Spigot-66f9d3c-384e116]
at java.lang.Thread.run(Thread.java:831) [?:?]
Caused by: java.lang.ClassNotFoundException: os
at org.bukkit.plugin.java.PluginClassLoader.loadClass0(PluginClassLoader.java:142) ~[spigot-1.17.jar:3124-Spigot-66f9d3c-384e116]
at org.bukkit.plugin.java.PluginClassLoader.loadClass(PluginClassLoader.java:99) ~[spigot-1.17.jar:3124-Spigot-66f9d3c-384e116]
at java.lang.ClassLoader.loadClass(ClassLoader.java:519) ~[?:?]
... 12 more
It seems he can't resolve the obfuscated classes. Thank you |
| Comments |
| Comment by David Maes [ 13/Jun/21 ] |
|
Thanks for clarifying that for me. |
| Comment by md_5 [ 13/Jun/21 ] |
|
All fields in the normal jar will be obfuscated; most classes will be named slightly differently; and some methods will be obfuscated/named differently. The output jar should contain not Mojang internals, but Spigot internals. If you add <remappedArtifactAttached>true</remappedArtifactAttached> To the second <configuration> this will make it clear by producing a -spigot jar. |
| Comment by David Maes [ 13/Jun/21 ] |
|
hi md_5, The normal jar is not obfuscated. I must be misunderstanding something here. |
| Comment by md_5 [ 12/Jun/21 ] |
|
HI, you need to use Plugin.jar not Plugin-obf.jar |