CI build server problems - Unable to locate resource in repository

We are new gradle users, and we are trying to set up our TeamCity server to do CI builds of our Android project that has recently been migrated from ant scripts to Android Studio + gradle. We have integrated robolectric, and we are all able to build and test locally. However, when running the ‘test’ target from the build server, we keep getting the following:

com.mycompany.android.myapp.StringsTest > my_order_title_message_format STANDARD_ERROR

Downloading: org/robolectric/android-all/4.3_r2-robolectric-0/android-all-4.3_r2-robolectric-0.pom from repository public at https://maven.mycompany.net/content/repositories/myapp

Unable to locate resource in repository

I don’t yet fully understand how gradle handles dependency management, but there’s something very confusing about the error message above. The URL referenced is defined only in an uploadArchives target under repositories.mavenDeployer (intended to be used to publish artifacts after doing an assemble build). I tried commenting out all of this code, building clean and then re-running tests, but I still end up with this same error message, and I have absolutely no clue who/what is referencing that URL. In our top level build.gradle file, we have the following:

allprojects {

repositories {

mavenCentral()

} }

in robolectric-tests/build.gradle, we have the following:

dependencies {

testCompile ‘org.robolectric:robolectric:2.4’ }

Even though I am running gradle with --info, I see no evidence that the tests are trying to download robolectric jars from maven central. I’ve also tried adding a repositories declaration (with mavenCentral as the one entry) to my robolectric-tests/build.gradle file with the same outcome. I’m very confused by all of this and could use any advice on how to resolve or troubleshoot why gradle is deciding to try to use the path to our archive upload location to download dependencies and doesn’t seem to be using maven central.

If “Downloading: …” is the standard error output, then a test is trying to download that Jar, not Gradle.

Peter, thank you for the reply, but I don’t understand your answer. When you say try downloading the jar, try downloading it from where/how? The problem is that I don’t want gradle to download from our internal repository, and I have no idea why gradle is trying to download anything from our internal repository.

I have a VNC connection into the build server, and I am definitely able to download robolectric and robolectric-android-all jars and pom files from a web browser (Safari). I tested this just now.

I didn’t say that you should try downloading something. I said that the test is apparently trying to download something.

Peter, sorry, I misunderstood. None of the tests that are failing try to download anything directly as part of the test, but it looks like this is a product of the Robolectric gradle test runner trying to satisfy some sort of dependency. It (or something tied to maven underneath it) appears to be the one emitting this log message. I thought it was gradle emitting it as part of its dependency management. Thank you very much for getting me pointed in the right direction.