Question How to make plugin library structure for multiple NMS version support?

tetratheta

New member
Oct 2, 2022
6
1
1
I want to make a plugin library that supports multiple NMS versions.

This is what I expect my library provides/does:

  • Provide classes/methods that depends on NMS/Paper API
    • This should use each NMS version's actual implementation
  • Provide classes/methods that independent of NMS/Paper API, or depend on something that would less likely to be changed
    • For example, class only depends on JavaPlugin or BukkitRunnable
  • Provide Javadoc of itself

Actually, I've already made one, but JitPack fails to build the artifact correctly. This usually means there is problem with my library structure or build script. That's why I ask about project structure because I don't know how to improve this situation at all.

Here is what I've made.



There is currently two submodule of this project. One is core and other one is bukkit_1_19_R1.

core will provide:
  • Classes/methods that depends on classes that less likely to be changed - like JavaPlugin or BukkitRunnable
  • Interface of classes that depends on each NMS versions
    • Will use reflection for actual usage when used
bukkit_1_19_R1 will provide:
  • Actual implementation of classes that depdns on each NMS version and this submodule is for 1.19 R1 version
All codes are commented with Javadoc things.



Any help would be appreciated. I really don't know what to do.
 

SkytAsul

New member
Dec 20, 2022
6
1
3
Bretagne, France
linktr.ee
Your project structure is actually good, that's how you should do it. Your issue comes from gradle:
Code:
⚠️ ERROR: No build artifacts found
Expected artifacts in: $HOME/.m2/repository/com/github/exmsrv/mol/1.0.0-SNAPSHOT
(that's the Jitpack error)
I use Gradle very rarely so I can't help you with this, but you should take a look at your Gradle configurations :)
 

tetratheta

New member
Oct 2, 2022
6
1
1
Your project structure is actually good, that's how you should do it. Your issue comes from gradle:
Code:
⚠️ ERROR: No build artifacts found
Expected artifacts in: $HOME/.m2/repository/com/github/exmsrv/mol/1.0.0-SNAPSHOT
(that's the Jitpack error)

Well, that's the problem.

For some reason that I don't understand at all, Gradle cannot produce 'combined javadoc' well.

Just running javadoc task won't create anything because there isn't any src in root project. I have to tell Gradle to collect all javadocs from its subprojects.

Local build are fine. Both library jar and javadoc jar is created when 'build'. But both publishing to maven local and JitPack, none of them are created.



I was told that if I use Maven instead of Gradle, these process can be easily done (not heard about how to do it though), but since paperweight only supports Gradle, I have no choice but to use Gradle for my project.

And I'm stuck at this point, for few weeks.




Thanks for the information!
 

electronicboy

Administrator
Staff member
Dec 11, 2021
216
10
34
28
There are plugins to do aggregate javadocs for gradle, which is what you want if you're gonna combine stuff; otherwise the things upset because you're not publishing to the local maven repo which is apparently what jitpack expects
 

tetratheta

New member
Oct 2, 2022
6
1
1
There are plugins to do aggregate javadocs for gradle, which is what you want if you're gonna combine stuff; otherwise the things upset because you're not publishing to the local maven repo which is apparently what jitpack expects

There is io.freefair.aggregate-javadoc-jar Gradle plugin that produces javadoc jar (and I guess this is what you mean), but when I tried it, it tried to generate javadoc jar which its size is more than 6GB without any reasonable reason. The required files were in the jar file, but its size kept growing until I force stop the process. I even created issue to their GitHub repository, but haven't got any response from them.

That's why I did some weird stuff on my build script. I only use io.freefair.aggregate-javadoc which is working well (at least I guess).
 
Last edited: