Created
January 24, 2013 18:12
-
-
Save djangofan/4625910 to your computer and use it in GitHub Desktop.
Trying to create a uber.jar build file for a Gradle multi-project build
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
apply plugin: 'java' | |
group = 'qa.webdriver' | |
subprojects { | |
apply plugin: 'java' | |
project.ext.sourceCompatibility = 1.6 | |
repositories { | |
mavenCentral() | |
maven { | |
url "http://maven2.javacpp.googlecode.com/git/" | |
} | |
maven { | |
url "http://maven2.javacv.googlecode.com/git/" | |
} | |
} | |
dependencies { | |
compile group: 'org.sikuli', name: 'sikuli-api', version: '1.0.+' | |
compile group: 'org.seleniumhq.selenium', name: 'selenium-java', version: '2.+' | |
compile group: 'junit', name: 'junit', version: '4.+' | |
compile group: 'org.slf4j', name: 'slf4j-api', version: '1.7.+' | |
compile group: 'ch.qos.logback', name: 'logback-core', version: '1.0.+' | |
compile group: 'ch.qos.logback', name: 'logback-classic', version: '1.0.+' | |
} | |
test { | |
testLogging { | |
exceptionFormat "full" | |
events "started", "passed", "skipped", "failed", "standardOut", "standardError" | |
} | |
} | |
// move this task to the sub project build file because of the Main-Class value | |
task testJar(type: Jar) { | |
classifier = 'tests' | |
from sourceSets.test.output.classesDir | |
manifest { attributes 'Main-Class': 'qa.webdriver.tests.GoogleTest' } | |
} | |
} | |
subprojects.each { subproject -> evaluationDependsOn( subproject.path ) } | |
task uberJar(type: Jar, dependsOn: subprojects.tasks['testClasses'] ) { | |
baseName = 'uberJar' | |
subprojects.each { subproject -> | |
from subproject.configurations.archives.allArtifacts.files.collect { | |
zipTree(it) | |
} | |
from files(subproject.tasks["test"].testClassesDir) | |
from configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } | |
} | |
} | |
artifacts { | |
archives uberJar | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment