Last active
February 2, 2018 04:44
-
-
Save dumptruckman/a851ddaaca226726b3004c1063d9e0a3 to your computer and use it in GitHub Desktop.
Basic Bukkit Gradle script
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
// You need this to create an "uberjar" | |
plugins { | |
id "com.github.johnrengelman.shadow" version "2.0.2" | |
} | |
apply plugin: 'java' | |
apply plugin: 'com.github.johnrengelman.shadow' // also needed for "uberjar" | |
group 'xyz.yourdomain' | |
version '0.0.1' | |
sourceCompatibility = 1.8 | |
targetCompatibility = 1.8 | |
repositories { | |
mavenCentral() | |
maven { | |
url "https://hub.spigotmc.org/nexus/content/repositories/snapshots/" | |
} | |
} | |
dependencies { | |
// compileOnly dependencies are not included in your jar | |
compileOnly 'org.bukkit:bukkit:1.12.1-R0.1-SNAPSHOT' | |
// compile dependencies will be included in your jar | |
compile 'org.bstats:bstats-bukkit:1.1' | |
// test dependencies for unit testing and such | |
testCompile group: 'junit', name: 'junit', version: '4.12' | |
} | |
// Stuff for your "uberjar" | |
jar.finalizedBy shadowJar | |
shadowJar { | |
baseName = project.name | |
classifier = null | |
// Relocates the packages of bstats so they don't conflict with other plugins | |
relocate 'org.bstats', 'bstats.yourpluginname' | |
} | |
// Creates a sources jar (optional) | |
task sourcesJar(type: Jar, dependsOn: classes) { | |
classifier 'sources' | |
from sourceSets.main.allSource | |
} | |
// Creates a javadoc jar (optional) | |
task javadocJar(type: Jar) { | |
classifier 'javadoc' | |
from javadoc.destinationDir | |
} | |
artifacts { | |
archives sourcesJar // comment out for no sources jar | |
archives javadocJar // comment out for no javadoc jar | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment