#Creating an External Library via Maven
1 messages · Page 1 of 1 (latest)
alright
so I set up the project, now I know I have to modify the pom.xml file to support dependencies but not sure exactly what to put
First off, did you install the library that you made to your local repo?
I.E. Did you run maven install?
Are you using intellij?
Ok, so there should be a tab on the right side labeled Maven.
Ok. so now you need to go to your other project that will depend on your library.
In your pom, you need to add that library as a dependency.
This can be done just like any other dependency.
so both my projects (library and plugin) need to be maven projects right
if the plugin isn't can I just add it as a module
Yes
oh alright
I haven't really used IntelliJ modules before, but maven modules are a little more complex.
For your case, I'd stick with separate projects.
okay, I turned it into a maven project
Maven modules are really for projects that have internal things that could be swapped. The most common usecase for spigot plugin development is server versioning.
I.E. 1.18.2 vs 1.17.2
Two different versions, which the submodules can switch between.
Since you are creating a library, you'd want it to be a separate project.
That way, you don't end up compiling it into every project that depends on it.
So, to add it as a dependency, what do I put in these fields?
The values that you put in your library's pom.xml.
so these?
Yes.
If you look at your library's pom, you;ll see the same exact fields. Take those values and put it in your project's pom as the values for the new dependency.
well yes, the screenshot above is of the library's fields, and I've now copied them in, what's next?
You'll want to push this button on the maven tab.
That way, the project can update the pom.
yep, did it
If you aren't getting any errors, then you're all set. You can now use all of the classes that are in the library.
oh dang
alright lemme test it
Okay, well I'm trying to add spigot as a dependency as well but it seems like it doesn't recognize the version
Spigot is a weird case. You'll need to run BuildTools in order for it to work with maven.
?buildtools
?bt
Hmm
1 sec
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
Spigot can't be distributed through the maven repos, so you have to install it manually.
so I run java -jar BuildTools.jar --rev 1.18.2 in the maven goal executor?
The reason why is due to the legal issues that Bukkit brought about when it got DMCA'ed all that time ago.
No, you'd just run that in your normal console/terminal.
Command Prompt.
You also need to download the jar and run the command in the same directory that the jar file is.
Or write the path to the jar.
Same error
You need to navigate to the directory that BuildTools is in.
Alternatively, you could just open command prompt in the same directory with the right click menu.
You may need to Shift + Right Click.
well doesn't that mean I need to download BuildTools first