When specifying an ivy repository, my ivy files are downloaded correctly, but not my jars


(murphey.craig) #1

I have the following in my multiproject root build.gradle file:

subprojects {
    apply plugin: 'java'
      repositories {
        ivy {
            artifactPattern "http://artifactory/ivy/[organisation]/[module]/jars/[artifact]-[revision].[ext]"
            ivyPattern "http://artifactory/ivy/[organisation]/[module]/ivys/[artifact]-[revision].[ext]"
        }
    }
}

And the following in my sub project’s build.grade file:

version = '1.0'
jar {
    manifest {
        attributes 'Implementation-Title': 'myproject', 'Implementation-Version': version
    }
}
dependencies {
    compile (
        [group: 'log4j', name: 'log4j', version: '1.2.16'],
        [group: 'commons-codec', name: 'commons-codec', version: '1.5'],
        [group: 'commons-lang', name: 'commons-lang', version: '2.6'],
        [group: 'org.springframework', name: 'spring-beans', version: '3.0.3.RELEASE'],
        [group: 'org.json', name: 'json', version: '20090211']
    )
    testCompile (
        [group: 'junit', name: 'junit', version: '4.8.2']
    )
}

My artifactory server has the following structure:

http://artifactory/ivy/log4j/log4j/jars/log4j-1.2.12.jar
http://artifactory/ivy/log4j/log4j/ivys/log4j-1.2.12.xml

When I build my project from the root after clearing out my ~/.gradle folder, the ivy files from my artifactory server get downloaded fine, but not my jars.

ubuntu@trunk:~/trunk/server$ gradle build
:util:compileJava UP-TO-DATE
:util:processResources UP-TO-DATE
:util:classes UP-TO-DATE
:util:jar UP-TO-DATE
:util:assemble UP-TO-DATE
:util:compileTestJava UP-TO-DATE
:util:processTestResources UP-TO-DATE
:util:testClasses UP-TO-DATE
:util:test UP-TO-DATE
:util:check UP-TO-DATE
:util:build UP-TO-DATE
:util:myproject:compileJava
Download http://artifactory/ivy/log4j/log4j/ivys/ivy-1.2.16.xml
Download http://artifactory/ivy/commons-codec/commons-codec/ivys/ivy-1.5.xml
Download http://artifactory/ivy/commons-lang/commons-lang/ivys/ivy-2.6.xml
Download http://artifactory/ivy/org.springframework/spring-beans/ivys/ivy-3.0.3.RELEASE.xml
Download http://artifactory/ivy/org.json/json/ivys/ivy-20090211.xml
Download http://artifactory/ivy/org.springframework/spring-core/ivys/ivy-3.0.3.RELEASE.xml
Download http://artifactory/ivy/org.springframework/spring-asm/ivys/ivy-3.0.3.RELEASE.xml
Download http://artifactory/ivy/commons-logging/commons-logging/ivys/ivy-1.1.1.xml
  FAILURE: Build failed with an exception.
  * What went wrong:
Could not resolve all dependencies for configuration ':util:myproject:compile'.
> Could not download artifact 'log4j:log4j:1.2.16:log4j.jar'
   > Artifact 'log4j:log4j:1.2.16:log4j.jar' not found.
  * Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
  BUILD FAILED
  Total time: 4.085 secs
ubuntu@trunk:~/trunk/server$

I must have something misconfigured, but I can’t figure out what. Anyone know?


(Peter Niederwieser) #2

When you run with ‘–info’ or ‘–debug’, you should see which URLs it’s trying to hit.


(murphey.craig) #3

I thought I had scanned through the debug logs, but I guess not quite hard enough. Found the following line:

16:05:35.796 [INFO] [org.gradle.api.internal.externalresource.transport.http.HttpClientHelper] Resource missing. [HTTP GET: http://artifactory/ivy/log4j/log4j/jars/log4j-1.2.16.jar]

That is indeed not present on my artifactory server. I was able to fix it by adding an additional artifact pattern that correctly resolved this dependency. Thanks for the help!