SKCraft / Launcher

🚀 Distribute your Minecraft modpacks with a custom launcher
Other
620 stars 433 forks source link

Unable to use command line to build modpacks #484

Closed Dreytac closed 2 years ago

Dreytac commented 2 years ago

I'm trying to build modpacks using the command line launcher-builder.jar file. Building with the creator-tools.jar works as expected.

When running with the -jar argument, I get this error:

no main manifest attribute, in D:\...\launcher-builder.jar

Sure enough, checking the MANIFEST.MF file inside the jar, there is no Main-Class attribute.

When running with the -cp launcher-builder.jar "com.skcraft.launcher.builder.PackageBuilder" argument, I get this error:

Error: Unable to initialize main class com.skcraft.launcher.builder.PackageBuilder Caused by: java.lang.NoClassDefFoundError: com/fasterxml/jackson/core/type/TypeReference

Java version: java 17.0.4 2022-07-19 LTS Java(TM) SE Runtime Environment (build 17.0.4+11-LTS-179) Java HotSpot(TM) 64-Bit Server VM (build 17.0.4+11-LTS-179, mixed mode, sharing)

Gradle builds successfully.

Dreytac commented 2 years ago

Exporting the server using -cp launcher-builder.jar "com.skcraft.launcher.builder.ServerCopyExport" also fails with:

Exception in thread "main" java.lang.NoClassDefFoundError: com/skcraft/launcher/util/SimpleLogFormatter at com.skcraft.launcher.builder.ServerCopyExport.main(ServerCopyExport.java:50) Caused by: java.lang.ClassNotFoundException: com.skcraft.launcher.util.SimpleLogFormatter at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641) at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520) ... 1 more

I'm not sure what's happening here as the launcher, the bootstrapper, creator tools and even the fancy launcher work perfectly. I've tried recompiling multiple times and even deleting the entire Gradle cache.

Dreytac commented 2 years ago

Some progress tonight. If I build just the "launcher" and "launcher-builder" projects, it works fine. Dependency or build order issue?

hedgehog1029 commented 2 years ago

Wonder if that's a result of gradle 7 dependency resolution. There's a couple weird quirks with the gradle build at the moment that I have a fix pending for locally, I'll push that when I get the chance

hedgehog1029 commented 2 years ago

Are you getting the "Execution optimizations have been disabled for task" warnings? If not I wonder if it's doing those "execution optimizations" and going wrong because of bugs in gradle shadow

Dreytac commented 2 years ago

Yeah I get a ton of them. I thought they might be related. I did some research online but I don't know anywhere near enough about Gradle to even attempt to know what's going on.

Edit: Ok, the apparent fix had nothing to do with what I was researching. It turned out to be rather simple.

hedgehog1029 commented 2 years ago

Fixed in 13b6a77d7780aa4eb51fd5d7bf92ebb1d6ef0a7a