-
-
Save liqweed/7460c109d669ced537d1fe2b3f13d0fd 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