JoelGodOfwar / SinglePlayerSleep

SinglePlayerSleep
https://www.spigotmc.org/resources/single-player-sleep.68139/
MIT License
20 stars 8 forks source link

Enable maven builds #17

Closed JohnTrapp closed 3 years ago

JohnTrapp commented 3 years ago

What is going on here?

While this merge request looks huge, the actual changes are small. However, they required moving files around so that's why you're seeing all these changes.

lib folder

Because the project uses classes from spigot and the VentureChat and bloodmoon plugins, those jars need to be made available to maven so it can include them on the classpath to be picked up by the java compiler. Because these plugins are not available on a maven repository, their jars must be downloaded manually. By including them in the repo, we are ensuring version integrity, making it easier to get started developing, reduce packaging mistakes, and make using a CI server easier. For the time being spigot.jar will have to be built individually thanks to some confusing licensing. VentureChat and bloodmoon, however, do not have such restrictions.

Pom file

The pom file gets a huge overhaul in this pull request. All required dependencies are included and will now be automatically downloaded (except for the ones listed above).

Also, CI variables are added to dynamically change the jar name to reflect the desired version. (see README)

All source files moved

The best-practice directory structure for java projects is src/main/java/YOUR_CLASSES. The reason you see that all these files are changed is because they were moved into this structure. Nothing was changed/modified in the java files.

Yaml and lang files moved

Like the source files, resources that need to be included in the jar should be in the src/main/resources/ directory. As before, the only thing that changed about these files were their location.

README paragraph

Some instructions on building the jar with maven are added to the README.

What to expect after merging

Because all these files have changed, you might have trouble merging with some current changes. All you have to do is make a copy of the repo before merging and copy/paste the files you have changed. You might also need to delete and reimport the project in your IDE so it can start using maven to build. Yes, it's a bit of a chore, but it's worth it overall as it'll only need to be done once.

Please let me know what you think!