I want to run a jar file with parameters located at C:/Users/nwuser/FitNesse/fitnesse-standalone.jar in my gradle script. I know how to do it without parameters:
If you're just trying to run a FitNesse test suite with Gradle, you can add the FitNesse jar to your dependencies:
repositories {
mavenCentral()
}
dependencies {
compile 'org.fitnesse:fitnesse:20161106'
}
and define a JavaExec
task like so:
task fitnesse(type: JavaExec) {
classpath = sourceSets.main.runtimeClasspath
main = 'fitnesseMain.FitNesseMain'
args '-c', 'FrontPage?suite&format=text'
}
And then run:
$ gradle fitnesse
...
Executing command: FrontPage?suite&format=text
--------
0 Tests, 0 Failures 0.091 seconds.
args is an array, so simply supply your arguments as such:
task runJar(dependsOn:jar) << {
javaexec {
main="-jar";
args = [
"C:/Users/nwuser/FitNesse/fitnesse-standalone.jar",
"-c",
"FrontPage?suite&format=text"
]
}
}