Allow passing system properties from gradle to java tasks (test and run)

signature-implementation
Tal Moran 2015-11-12 23:06:24 +02:00
parent 32258361a3
commit 5ffc08d07f
2 changed files with 19 additions and 27 deletions

View File

@ -57,6 +57,15 @@ dependencies {
/*==== You probably don't have to edit below this line =======*/
// The run task added by the application plugin
// is also of type JavaExec.
tasks.withType(JavaExec) {
// Assign all Java system properties from
// the command line to the JavaExec task.
systemProperties System.properties
}
protobuf {
// Configure the protoc executable
protoc {

View File

@ -57,6 +57,16 @@ dependencies {
/*==== You probably don't have to edit below this line =======*/
// The run task added by the application plugin
// is also of type JavaExec.
tasks.withType(JavaExec) {
// Assign all Java system properties from
// the command line to the JavaExec task.
systemProperties System.properties
}
protobuf {
// Configure the protoc executable
protoc {
@ -91,33 +101,6 @@ idea {
* "Fat" Build targets
*===================================*/
task fatjar(type: Jar) {
description = "Generate a single jar containing everything. Use -Pfatmain=... to override main class"
destinationDir = buildDir
def fatMain = hasProperty('fatmain') ? fatmain : mainClassName
def testJar = hasProperty('test')
appendix = "${fatMain}-fat"
if (testJar) {
from sourceSets.test.output
from configurations.testRuntime.collect { it.isDirectory() ? it : zipTree(it) }
}
from sourceSets.main.output // that's it
from { configurations.runtime.collect { it.isDirectory() ? it : zipTree(it) } }
exclude 'META-INF/MANIFEST.MF'
exclude 'META-INF/*.SF'
exclude 'META-INF/*.DSA'
exclude 'META-INF/*.RSA'
manifest { attributes 'Main-Class': fatMain }
}
task mavenCapsule(type: MavenCapsule){
description = "Generate a capsule jar that automatically downloads and caches dependencies when run."