Run jar with parameters in gradle

后端 未结 2 970
半阙折子戏
半阙折子戏 2021-02-07 04:54

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:



        
2条回答
  •  谎友^
    谎友^ (楼主)
    2021-02-07 05:00

    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.
    

提交回复
热议问题