Я использую плагин Gradle IDE для Eclipse, и я создал пользовательскую задачу в моем build.gradle файле:Добавить зависимостей в Eclipse, используя Gradle
sourceSets {
unitTest {
java.srcDirs = ['tests']
}
}
dependencies {
unitTestCompile files("$project.buildDir/classes/debug")
unitTestCompile 'junit:junit:4.11'
unitTestCompile 'org.robolectric:robolectric:2.1.1'
unitTestCompile 'com.google.android:android:4.0.1.2'
}
configurations {
unitTestCompile.extendsFrom runtime
unitTestRuntime.extendsFrom unitTestCompile
}
task unitTest(type:Test, dependsOn: assemble) {
description = "run unit tests"
testClassesDir = project.sourceSets.unitTest.output.classesDir
classpath = project.sourceSets.unitTest.runtimeClasspath
}
build.dependsOn unitTest
Проблема заключается в том, что зависимости Я ссылки не добавлены в Eclipse, и я получаю сообщение об ошибке import org.junit.Test;
, import org.robolectric.Robolectric;
и т. д., не может быть разрешено. Я попытался щелкнуть правой кнопкой мыши по проекту -> Gradle -> Refresh Dependencies, но безрезультатно.