Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Required code is commented with // REQ
- // Better than some other solutions because dependencies don't need to be declared twice
- // As in, "shadow 'my-dep:0.1'" also adds it to the compile dependencies list
- plugins {
- id 'java'
- id 'idea'
- id 'com.github.johnrengelman.shadow' version '1.2.3' // REQ
- }
- group '...'
- version '1.0-SNAPSHOT'
- // Dependencies
- repositories {
- mavenCentral()
- maven {
- name = 'sponge'
- url = 'http://repo.spongepowered.org/maven'
- }
- }
- dependencies {
- compile 'org.spongepowered:spongeapi:4.1.0-SNAPSHOT'
- shadow 'org.mongodb:mongodb-driver:3.2.2' // REQ (replace with your desired dependency)
- shadow 'org.jgrapht:jgrapht-core:0.9.1'
- shadow 'org.reflections:reflections:0.9.10'
- testCompile group: 'junit', name: 'junit', version: '4.11'
- }
- idea {
- module {
- downloadJavadoc = true
- downloadSources = true
- }
- }
- // Build
- project.configurations.compile.extendsFrom(project.configurations.shadow) // REQ
- // BEGIN REQ
- shadowJar {
- classifier = 'dist' // (this will be appended to the jar filename. Ex: myProj-dist.jar)
- configurations = [project.configurations.shadow]
- dependencies {
- exclude(dependency('com.google.guava:guava')) // (replace with any child dependencies that you don't want)
- }
- }
- build.dependsOn(shadowJar)
- // END REQ
Advertisement