1.2 doesn't resolve from mavenRepo where 1.0 does

I have a simple Gradle build. I was using it successfully with 1.0 telling it to resolve dependencies from my internal Artifactory mavenRepo. I changed to 1.2 (and configured the wrapper) and it can no longer resolve the groovy jar with out a mavenCentral declaration suggesting it no longer will use my mavenRepo. The situation is the same whether I use Gradle directly or through the wrapper. Following is the entire build.gradle:

version = '0.0.1'
  defaultTasks 'build', 'groovydoc'
  apply plugin: 'groovy'
sourceCompatibility = 1.6
  apply plugin: 'eclipse'
  apply plugin: 'codenarc'
codenarc {
 toolVersion = '0.17'
 configFile = file('config/codenarc/rules.groovy')
}
  apply plugin: 'maven'
  repositories {
 maven {
  url "http://cletus:8080/artifactory"
 }
    mavenRepo name: 'libs-repo', url: "http://cletus:8080/artifactory/libs-release"
    // TODO: find out why with Gradle 1.2 I need this, not so with Gradle 1.0
 mavenCentral()
}
  dependencies {
 groovy "org.codehaus.groovy:groovy-all:1.8.6"
    testCompile 'junit:junit:4.10'
 testCompile('org.spockframework:spock-core:0.7-groovy-1.8') {
  exclude group: 'org.codehaus.groovy'
   exclude group: 'junit'
  }
}
  task wrapper(type: Wrapper) {
 gradleVersion = '1.2'
}

Have you double checked that your Maven repo (specifically ‘libs-release’) still contains the dependency? You should see both in Gradle’s info log and in Artifactory’s log whether the repo is accessed or not. Another thing to try is to use the new ‘maven’ syntax everywhere, instead of mixing ‘maven’ and ‘mavenRepo’. Although I don’t think it will make a difference.

Also, make sure to try with ‘–refresh-dependencies’.

Upon further investigation, it appears that my problem is one of security config in Artifactory, nothing to do with the Gradle version. I think I was tricked by Gradle grabbing from the local cache (with 1.0). I’m still a newbie with Artifactory. This could explain other issues I’ve seen working with Grails too.

I’m not sure what you mean by the “new” maven syntax and the “mixing” of maven and mavenRepo. I’ll give the 1.2 docs a closer look and try to just use the maven syntax. I have in the past found the docs in this area a bit confusing, hence the mixing. Frankly, I still don’t understand the point of the 2 syntaxes.

BTW, congrats on spock1.7. I’m becoming a huge Spock fanboy, especially as the docs improve. I’m very happy to see the high priority on that for 1.0. As a longtime TDD’er and user of EasyMock, the mocking put me off a bit at first but now I really like it. Did I say I like it A LOT ??

;=)

Ken

I mean ‘maven { url “…” }’ vs. ‘mavenRepo(url: “…”)’. I don’t know why the latter syntax hasn’t been deprecated yet. Nevertheless, I’d stick to the former.

FWIW,

My issue was solved by the -refresh-dependencies switch.

I think was using mavenRepo because of Artifactory’s docs. No more.

Turns out I also needed a http.nonProxyHosts entry in gradle.properties. Stupid proxy server here.