How To Include Transitive Dependencies
Posted
by
Brad Rhoads
on Stack Overflow
See other posts from Stack Overflow
or by Brad Rhoads
Published on 2014-06-06T21:14:23Z
Indexed on
2014/06/06
21:25 UTC
Read the original article
Hit count: 183
I have 2 gradle projects: an Android app and a RoboSpock test.
My build.gradle for the Android app has
. . .
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
compile ('com.actionbarsherlock:actionbarsherlock:4.4.0@aar') {
exclude module: 'support-v4'
}
}
. . .
and builds correctly by itself, e.g assembleRelease works.
I'm stuck getting the test to work. I gets lots of errors such as:
package com.google.zxing does not exist
Those seem to indicate that the .jar files aren't being picked up.
Here's my build.gradle for the test project:
buildscript {
repositories {
mavenLocal()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.9.+'
classpath 'org.robospock:robospock-plugin:0.4.0'
}
}
repositories {
mavenLocal()
mavenCentral()
}
apply plugin: 'groovy'
dependencies {
compile "org.codehaus.groovy:groovy-all:1.8.6"
compile 'org.robospock:robospock:0.4.4'
}
dependencies {
compile fileTree(dir: ':android:libs', include: '*.jar')
compile (project(':estanteApp')) {
transitive = true
}
}
sourceSets.test.java.srcDirs = ['../android/src/', '../android/build/source/r/debug']
test {
testLogging {
lifecycle {
exceptionFormat "full"
}
}
}
project.ext {
robospock = ":estanteApp" // project to test
}
apply plugin: 'robospock'
As that shows, I've tried adding transitive = true and including the .jar files explicitly. But no matter what I try, I end up with the package does not exist error.
© Stack Overflow or respective owner