简体   繁体   中英

How to add a custom JAR file to CLASSPATH when running gradle from command line?

Same question as this except that, how to do this for Gradle?

I have placed cucumber-android and some other JAR files related to cucumber in my app/libs directory. This is part of my build.gradle:

buildscript {
   dependencies {
    classpath 'io.fabric.tools:gradle:1.19.2'
    classpath fileTree(dir: 'libs', include: '*.jar')
  }
}
dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile fileTree(dir: 'libs', include: ['*.jar'])

When I run a cucumber feature test from Android Studio, it runs successfully, because Android Studio automatically includes the files in the libs directory into CLASSPATH.

When I run the test from command line using

./gradlew --info cC

I get the error:

cucumber.runtime.CucumberException: No backends were found. Please make sure you have a backend module on your CLASSPATH.

This is because the JAR files in the libs are not in the CLASSPATH. How do I include JAR files when running cc in gradle?

我必须从具有@CucumberOptions批注的类中删除@RunWith(Cucumber.class)批注。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM