I want to launch my instrumented tests with a daily task on windows, but the company has a proxy. I can launch the gradle command with gradlew -Dhttp.proxyHost=x.x.x.x -Dhttp.proxyPort=xxxx -Dhttps.proxyHost=x.x.x.x -Dhttps.proxyPort=xxxx connectedProdDebugAndroidTest and everyhting seems running smooth until the test fails on building because of a timeout on the sftp repo containing our company libs.

When I run the gradle sync with Android studio it's working well.

Here is how me repo is configured :

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "xxxxxxxxx"
        minSdkVersion 19
        targetSdkVersion 28
        versionCode 1
        versionName versionString
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
....

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])

    // Company libs
    implementation 'xxxxxx:xxxxx:2.0.7.47'
    implementation 'xxxxxx:xxxxxxxxxx:+'
    implementation 'xxxxxx:xxxxxxxx:1.0.0.1'
    implementation 'xxxxxx:xxxxxxxxxxxx:+'

    // Retrofit & okhttp libs
    implementation 'com.squareup.retrofit2:retrofit:2.1.0'
    implementation 'com.squareup.retrofit2:converter-gson:2.1.0'
    implementation 'com.squareup.okhttp3:okhttp:3.4.1'
    implementation 'com.squareup.okhttp3:logging-interceptor:3.4.1'

    //Test
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'

    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    androidTestImplementation 'com.android.support.test:rules:1.0.2'

}

repositories {
    mavenLocal()
    mavenCentral()
    maven {
        url 'sftp://xxx.xx.x.x:8080/home/maven'
        credentials {
            username 'xxx'
            password 'xxxxxxxxxxx'
        }
    }
}

How can I make the gradle sftp connection pass trough proxy in command line ?

0 Answers