-1

I have created one gradle project for Geb-Spock. In this project I have created scripts in Groovy class.

I would like to execute those scripts from command line with the help of gradle commands. So that I can achieve Jenkins - Gradle - Geb integration.

Can you please help me to get the command which can execute the gradle-groovy scripts from windows command line. Thanks for your help on this.

Durgesh
  • 585
  • 4
  • 12
  • 33

1 Answers1

0

Maybe so. If I understood correctly, you want run it like:

gradle myScript

You define a Task in gradle and import your groovy class into build.gradle like:

import com.MyScript
task myScript(){
     new MyScript().run()
}

You also need a dependecy for your script (look her). e.g.:

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath files('path/to/myScript/lib')
    }
}

Also take a look how to compile the code for buildscript classpath if you need: https://docs.gradle.org/current/userguide/organizing_build_logic.html#sec:build_sources

I'm not really sure that you need all that. If you just want to run some Geb-Spock Test in Gradle take a look in https://github.com/geb/geb-example-gradle

Community
  • 1
  • 1
CyberAleks
  • 1,545
  • 1
  • 14
  • 17