Correct scope of Bukkit API dependency#16
Open
satoshinm wants to merge 1 commit intoBukkit:masterfrom
Open
Conversation
The org.bukkit:bukkit dependency was scoped to "compile", which will cause it to be included in the plugin jar with [maven-shade-plugin](https://maven.apache.org/components/plugins/maven-shade-plugin/), for example. This can be avoided with exclusions but a cleaner fix is to change the scope to "provided", as this is the intended purpose: dependencies provided at runtime. From the [Maven documentation](http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#Dependency_Scope): > provided > This is much like compile, but indicates you expect the JDK or a container to provide the dependency at runtime. For example, when building a web application for the Java Enterprise Edition, you would set the dependency on the Servlet API and related Java EE APIs to scope provided because the web container provides those classes. This scope is only available on the compilation and test classpath, and is not transitive. This accurately describes the Bukkit API dependency.
satoshinm
added a commit
to satoshinm/WebSandboxMC
that referenced
this pull request
Apr 17, 2017
The Bukkit API was specified with compile scope, causing it to be shaded into the plugin jar by default. Requested change to Bukkit/SamplePlugin here: Bukkit/SamplePlugin#16 - to scope provided, this is intended for dependencies provided at runtime (i.e., Bukkit) so removes all the unnecessary deps in the jar, ebean etc. Remainder of this commit is coping with this fix: cleaning up the unneeded relocations and exclusions, and breaking the unintentional dependency on Google Commons where Charset was used although it is not needed and available in java.nio. Netty is still shaded for server software version independence, but even with it included and the NetCraft binary, end result is plugin shrinks from 6.0 to 2.6 MB, well under the Spigot Resources limit of 4 MB.
Member
RIP ⚰️ |
Author
|
Thanks for the reply, I guess I'll leave this pull request open even if it won't be merged, to allow others searching for a "bukkit sample plugin" to find this fix and save them some trouble if they decide to base their plugin on it (as I have). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The org.bukkit:bukkit dependency was scoped to "compile", which will cause it to be included in the plugin jar with maven-shade-plugin, for example. This can be avoided with exclusions but a cleaner fix is to change the scope to "provided", as this is the intended purpose: dependencies provided at runtime.
From the Maven documentation:
This accurately describes the Bukkit API dependency.