Francois
Francois

Reputation: 2066

Dependencies not resolved after gradle upgrade from 1.12 to 2.4

After upgrading gradle from 1.12 to 2.4 on Win7, dependencies could not be resolved anymore in a gradle project.
Actually, in the same terminal (a bash terminal in windows), this succeeds:

$ /c/Program\ Files\ \(x86\)/gradle-1.12/bin/gradle dependencies
:dependencies

------------------------------------------------------------
Root project - MyProject
------------------------------------------------------------

archives - Configuration for archive artifacts.
No dependencies

compile - Compile classpath for source set 'main'.
Download http://repo1.maven.org/maven2/com/sun/mail/mailapi/1.5.4/mailapi-1.5.4.pom
Download http://repo1.maven.org/maven2/com/sun/mail/all/1.5.4/all-1.5.4.pom
Download http://repo1.maven.org/maven2/net/java/jvnet-parent/1/jvnet-parent-1.pom
Download http://repo1.maven.org/maven2/com/sun/mail/smtp/1.5.4/smtp-1.5.4.pom
Download http://repo1.maven.org/maven2/com/sun/mail/parent-distrib/1.5.4/parent-distrib-1.5.4.pom
Download http://repo1.maven.org/maven2/com/sun/mail/dsn/1.5.4/dsn-1.5.4.pom
Download http://repo1.maven.org/maven2/com/google/code/gson/gson/2.3/gson-2.3.pom
Download http://repo1.maven.org/maven2/org/sonatype/oss/oss-parent/9/oss-parent-9.pom
Download http://repo1.maven.org/maven2/org/apache/logging/log4j/log4j-core/2.3/log4j-core-2.3.pom
Download http://repo1.maven.org/maven2/org/apache/logging/log4j/log4j/2.3/log4j-2.3.pom
Download http://repo1.maven.org/maven2/org/apache/apache/9/apache-9.pom
Download http://repo1.maven.org/maven2/javax/activation/activation/1.1/activation-1.1.pom
Download http://repo1.maven.org/maven2/com/sun/mail/javax.mail/1.5.4/javax.mail-1.5.4.pom
Download http://repo1.maven.org/maven2/org/apache/logging/log4j/log4j-api/2.3/log4j-api-2.3.pom
+--- :Support:
+--- com.sun.mail:mailapi:1.5.4
|    \--- javax.activation:activation:1.1
+--- com.sun.mail:smtp:1.5.4
|    \--- javax.activation:activation:1.1
+--- com.sun.mail:dsn:1.5.4
|    +--- com.sun.mail:javax.mail:1.5.4
|    |    \--- javax.activation:activation:1.1
|    \--- javax.activation:activation:1.1
+--- com.google.code.gson:gson:2.3
\--- org.apache.logging.log4j:log4j-core:2.3
         \--- org.apache.logging.log4j:log4j-api:2.3 
...

whereas this fails:

$ /c/Program\ Files\ \(x86\)/gradle-2.4/bin/gradle dependencies
:dependencies

------------------------------------------------------------
Root project - MyProject
------------------------------------------------------------

archives - Configuration for archive artifacts.
No dependencies

compile - Compile classpath for source set 'main'.
+--- :Support:
+--- com.sun.mail:mailapi:1.5.4 FAILED
+--- com.sun.mail:smtp:1.5.4 FAILED
+--- com.sun.mail:dsn:1.5.4 FAILED
+--- com.google.code.gson:gson:2.3 FAILED
\--- org.apache.logging.log4j:log4j-core:2.3 FAILED
...

I have already tried this:
- upgraded maven from 3.1.1 to 3.3.3
- updated the PATH to access the new gradle-2.4 and maven-3.3.3
- reopened the windows session
- killed the gradle daemon
- deleted ~/.gradle/caches
- deleted ~/.gradle and recreated an empty one with the same gradle.properties
- deleted ~/.m2/repository
- checked the local cntlm proxy configuration (gradle-1.12 could access it perfectly well)
- tried with parameters "-Dhttp_proxyHost=127.0.0.1 -Dhttp_proxyPort=3128 -Dhttps_proxyHost=127.0.0.1 -Dhttps_proxyPort=3129"

Thanks for any advice.


content of gradle.build:

apply plugin: 'java'
apply plugin: 'maven'

group = 'my.project'
version = '0.0.1-SNAPSHOT'
description = "MyProject"

sourceCompatibility = 1.7
targetCompatibility = 1.7

//
// dependencies
//
repositories {
    mavenCentral()
    flatDir { dirs 'ext' }
}
dependencies {
    compile name : 'Support'
    compile group: 'com.sun.mail'            , name: 'mailapi'   , version:'1.5.4'
    compile group: 'com.sun.mail'            , name: 'smtp'      , version:'1.5.4'
    compile group: 'com.sun.mail'            , name: 'dsn'       , version:'1.5.4'
    compile group: 'com.google.code.gson'    , name: 'gson'      , version:'2.3'
    compile group: 'org.apache.logging.log4j', name: 'log4j-core', version:'2.3'

    testCompile group: 'org.easymock'        , name: 'easymock'  , version:'3.3'
    testCompile group: 'junit'               , name: 'junit'     , version:'4.12'
}

Upvotes: 1

Views: 155

Answers (1)

Roman
Roman

Reputation: 6656

In gradle 2.1 they switched mavenCentral() from HTTP to HTTPS. Maybe your proxy has some trouble with HTTPS (or gradle has some trouble with proxy when using HTTPS). You can switch back to HTTP (permanently or only to test this hypothesis) using the following code, which is taken from the above-mentioned release notes:

repositories {
    // note: this replaces mavenCentral()
    maven { url = 'http://repo1.maven.org/maven2/' }
}

And also take a look at "Accessing the web via a proxy" in the gradle user guide regarding your proxy configuration.

Upvotes: 1

Related Questions