Does 1.0-milestone-5 resolve transitive dependencies from maven repositories?


(Martin Göllnitz) #1

Can it be that M5 follows a different strategie for dependencies. I have a project where is use lib a which in turn uses lib b, but b is not included in the classpath for compiling


(Adam Murdoch) #2

It shouldn’t, but there is a bug with handling classifiers which means that some files may go missing: GRADLE-1838.

Can you give some more details about your build? Are libs a and b external or project dependencies? Are you using a Maven or Ivy repository? Does lib b have any jars with a classifier?


(Martin Göllnitz) #3

I’m not sure if it is related to GRADLE-1838. To me it doesn’t look like…

Since I’m experiencing this with most of my dependencies since the update (which helped a lot with the new artifact storage under the hood. All of my transient exceptions vanished) we can take the simple external lib dependency as an example:

a (named ‘:core’ in the real project https://github.com/mgoellnitz/tangram) uses groovy and groovy needs e.g. many artifacts from group-id asm. The don’t get packaged in the resulting war file.

Projects depending on a (project AND artifact dependency) are missing those dependencies.

My repository setup is the following: I have a local maven repo and am using some external maven repos as well. The artifacts we are talking about are not part of my local repository but are fetched from the external ones and stored in the local gradle/ivy cache. (In this cache no dependency is mentioned in any of the ivy files which I thought was different with M3 but have removed all the old files during update not to confuse my build)


(Adam Murdoch) #4

From your commons.gradle:

repositories {
    mavenLocal()
    maven {
    url localMavenRepository;
        artifactUrls localMavenRepository
    // most of the usual stuff
    artifactUrls "http://repo1.maven.org/maven2"
    // needed for latest spring framework and security versions
    artifactUrls "http://repository.springsource.com/maven/bundles/release"
    // needed for latest datanucleus versions
    artifactUrls "http://www.datanucleus.org/downloads/maven2"
    /* maybe unused
    artifactUrls "http://repository.jboss.org/maven2"
    artifactUrls "http://repository.codehaus.org"
    artifactUrls "http://fornax.itemis.de/nexus/content/repositories/thirdparty"
    */
  }
   }

Note that for a maven repository declaration, pom.xmls are only downloaded from the url specified by the ‘url’ property. Any url specified by ‘artifactUrls’ is used only for downloading the artifacts, not the pom.xml.

So, if you don’t have the pom.xml for, say, groovy at localMavenRepository, Gradle will look for the jar only at each of the urls.

You should define a separate maven repository for each actual repository that you want to use:

repositories {
    maven { url localMavenRepository }
    maven { url "http://repo1.maven.org/maven2" }
    maven { url "http://repository.springsource.com/maven/bundles/release" }
}

(Martin Göllnitz) #5

A, I see, that’s how I mis-read the migration hints. Thanks.