Last active
December 21, 2015 16:26
-
-
Save lucidfrontier45/5523bf3982b4acd9a1fd to your computer and use it in GitHub Desktop.
gradle with sbt-assembly like function
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
| group 'com.example' | |
| version '1.0' | |
| apply plugin: "java" | |
| apply plugin: "scala" | |
| apply plugin: "application" | |
| sourceCompatibility = 1.8 | |
| configurations { | |
| provided | |
| compile.extendsFrom provided | |
| } | |
| repositories { | |
| maven{ url "https://maven-central.storage.googleapis.com"} | |
| // mavenCentral() | |
| } | |
| ext { | |
| versions = [ | |
| scala: '2.10.4' | |
| ] | |
| } | |
| dependencies { | |
| compile "org.scala-lang:scala-library:${versions.scala}" | |
| testCompile group: 'junit', name: 'junit', version: '4.11' | |
| } | |
| task assembly(type: Jar) { | |
| // manifest { | |
| // attributes 'Implementation-Title': 'Gradle Jar File Example', | |
| // 'Implementation-Version': version, | |
| // 'Main-Class': 'com.example.mainclass' | |
| // } | |
| baseName = project.name + '-assembly' | |
| from { | |
| (configurations.runtime - configurations.provided).collect { | |
| it.isDirectory() ? it : zipTree(it) | |
| } | |
| } | |
| with jar | |
| } | |
| run { | |
| if (project.hasProperty('args')) { | |
| args project.args.split('\\s+') | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment