Created
January 10, 2020 19:25
-
-
Save aalmiray/0eb645379bde00fe948acb5e7b590229 to your computer and use it in GitHub Desktop.
This file contains 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
plugins { | |
id 'java-library' | |
id 'application' | |
id 'maven-publish' | |
id 'com.github.johnrengelman.shadow' | |
} | |
group = 'com.acme' | |
version = '0.0.0-SNAPSHOT' | |
application { | |
mainClassName = 'com.acme.Main' | |
} | |
// define any configurations you'd like | |
// here we mimic the default 'implementation' configuration | |
configurations { | |
customImplementation | |
} | |
repositories { | |
jcenter() | |
} | |
// use our custom configuration | |
dependencies { | |
customImplementation 'org.apache.commons:commons-lang3:3.9' | |
} | |
sourceSets { | |
main { | |
// wire the custom configuration tom the `compileClasspath` | |
// make sure to not miss it! | |
compileClasspath += configurations.customImplementation | |
runtimeClasspath += compileClasspath | |
} | |
} | |
shadowJar { | |
// instruct shadowJar to fetch dependencies from our custom configuration | |
configurations = [project.configurations.customImplementation] | |
// override classifier so that shadow overwrites the default JAR | |
archiveClassifier.set '' | |
} | |
// let shadow run after jar | |
jar.finalizedBy shadowJar | |
publishing { | |
publications { | |
mavenJava(MavenPublication) { | |
// benefit from default settings | |
from components.java | |
} | |
} | |
repositories { | |
maven { | |
url = "$buildDir/repo" | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment