gradle-spawn-plugin icon indicating copy to clipboard operation
gradle-spawn-plugin copied to clipboard

Feature Request: Spawn (test) dependency

Open matsev opened this issue 9 years ago • 1 comments

It would be good to be able to declare a third party dependency (either as compile or testCompile dependency) and be able to spawn it. The third party dependency may in turn have several dependencies on its own, so the gradle-spawn-plugin needs to traverse all transitive dependencies recursively and add them to the classpath.

Below is example of how it would be used (the syntax and naming are just suggestions):

import com.wiredforcode.gradle.spawn.*

buildscript {
    repositories {
        ...
        maven { url 'http://dl.bintray.com/vermeulen-mp/gradle-plugins' }
    }
    dependencies {
        classpath 'com.wiredforcode:gradle-spawn-plugin:0.6.0'
    }
}

dependencies {
    testCompile("com.example.dependency:third-party-jar:1.0.0")
}

apply plugin: 'com.wiredforcode.spawn'

task startServer(type: SpawnProcessTask, dependsOn: 'assemble') {
    artifactId 'third-party-jar' // name act as a predicate to select which artifact to be executed
    commandLineArgs '[optional string of command line args]'
    ready 'Started Application'
}

task stopServer(type: KillProcessTask)

test.dependsOn startServer

test.finalizedBy stopServer

matsev avatar Nov 27 '15 06:11 matsev

Currently available. I am using the syntax: task startMyProcess(type: SpawnProcessTask, dependsOn: [stopMyProcess, classes],...)

gorky avatar Oct 19 '17 19:10 gorky