Open randombyte-developer opened 7 years ago
Urgh I really should change to the idea jar launcher (which I might since the current method has to may problems) . It also looks like their are sponge dependencies marked as compile in your classpath.
You can basically take any of my recent updated plugins and test. Example plugin: https://github.com/randombyte-developer/easy-tellraw/blob/master/build.gradle (will release it today) Using sponge vanilla #1 happens. Using sponge forge (for 1.11.2) the error above happens. The current workaround is(as you can see in the build file) using sponge forge for 1.10.
Yeah I bet the kapt "org.spongepowered:spongeapi:5.1.0"
is messing it up. Since the plugin will look in the compile scope to remap all the dependencies to provided.
The way I code most of my plugins atm is with the following. When I press "start server" the following happens:
This does have some downsides:
Positive things are:
I don't know if this would be a good idea for SpongeStart tho. So what do you think? Scratch this messy classlauncher and run it correctly?
You have to build your plugin for each run. But android development is also done this way so it shouldn't be such a pain.
Doesn't bother me, the compiler is fast, especially with Kotlin's incremental compilation.
Your plugin runs in an obfuscated environment which might make debugging more troublesome.
Do you mean that NMS is obfuscated? It was anyway with SpongeStart. This didn't bother me, too.
- No need for a custom launcher class
- More guarantees that it actually will work (no more fiddling with gradle)
- Supports mixin plugins (with the current setup this doesn't work)
Well, good. :+1:
I changed kapt to compile and it is still the same error. Doesn't matter since I use a forge server for 1.10.2.
I am looking forward to the a new SpongeStart! Is there anything I could help with?
I am looking forward to the a new SpongeStart! Is there anything I could help with?
Wel to make this it is fairly simple:
java -jar server.jar
Wait, code hotswapping won't be possible anymore, right? That would be really really sad...
No, hot swapping will still work.
Ok, but we are talking about building the plugin to a jar and then copying the jar to the mods folder?
Yes. But as far I understood IDEA launches the jar in its own kind of wrapper (in debug mode). Which has the ability to replace classes. Even if you aren't actually launching from these classes. So far I know the only requirements is that the name of the class is the same.
I can't find any documentation on 'IntelliJ jar launcher'.
Yeah: https://www.jetbrains.com/help/idea/2017.1/run-debug-configuration-jar-application.html. It doesn't say anything about debugging. But I tested it before with noxray and it worked fine (not for mixins tho, but that is to be expected).
Are we going to directly manipulate the xml run configuration files? Like it is done now?
I am not really a fan of it. But apparently it works the best to solve the permission problems (although it makes zero sense to me).
How I fire up a test server:
run
folderorg.spongepowered.server.launch.VersionCheckingMain
-classpath path/to/project/run/vanilla/vanillaServer.jar:<otherStuff>
where otherStuff
is the whole classpath IntelliJ adds when I start a server with SpongeStart. I seems to include all the paths to the dependencies in jar form, e.g for the kotlin-stdlib: /home/randombyte/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.1.1/98e484e67f913e934559f7f55f0c94be5593f03c/kotlin-stdlib-1.1.1.jar
.--scan-classpath
to make Sponge look for plugins in the classpath.The cool thing about this is that the plugin isn't provided as a built jar but in form of the build folder. The otherStuff
I mentioned also contains this: /home/randombyte/development/sponge/projects/holograms/build/classes/main
.
Code hotswapping and debugging works.
The challenge is here to get the otherStuff
. As I said I do this by running SpongeStart and then copying it. Can we somehow generate this classpath with all dependencies? It has like 25 entries.
Wait can you overwrite the entire run configuration classpath with that?
It says so here:
The -classpath option specified in this field overrides the classpath of the module.
Whoa. You just found the holy grail to fix this issue.
How much would you have to change code wise to get it to work?
Nah still a lot, but the -classpath
solution is way cleaner than what I did. But as you might have notice time to start back to coding is more a problem for me 😟.
A fork/rework of this plugin fixing this issue amongst other things: https://github.com/ImMorpheus/SpongeStart/commit/58805d754295876f1bf2f3fba30651c5695adbb7
SpongeForge version:
1.11.2-2227-6.0.0-BETA-2260
SpongeStart version:1.6.2
Gradle version:3.1
When running the generated run configuration for the forge server: https://pastebin.com/XMjHmaXt