Skip to content

Instantly share code, notes, and snippets.

@lucidfrontier45
Last active December 21, 2015 16:26
Show Gist options
  • Select an option

  • Save lucidfrontier45/5523bf3982b4acd9a1fd to your computer and use it in GitHub Desktop.

Select an option

Save lucidfrontier45/5523bf3982b4acd9a1fd to your computer and use it in GitHub Desktop.
gradle with sbt-assembly like function
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