Gradle fails attempting to resolve jar for parent POM


(Santoash Rajaram) #1

Im trying to build a simple scala app using Gradle and Im running into issues trying to resolve dependency via our private artifactory. It looks like gradle is throwing an error when it can’t find a jar file for a parent pom .

Here is what I have in my repository:

repositories {
    ivy {
        mavenLocal()
          maven {
            url "https://mycompany.com/artifactory/repo/"
            credentials {
                username 'username'
                password 'password'
            }
        }
          url "https://mycompany.com/artifactory/repo/"
        credentials {
            username 'username'
            password 'password'
        }
        layout "pattern", {
            artifact "[organization]/[module]/[revision]/[type]s/[artifact](-[classifier]).[ext]"
            m2compatible=true
        }
      }
}

Here are the errors, I see:

Could not parse POM https://mycompany.com/artifactory/repo/org/fusesource/fusesource-pom/1.9/fusesource-pom-1.9.pom
                  > Could not HEAD 'https://mycompany.com/artifactory/repo/org/fusesource/fusesource-pom/1.9/fusesource-pom-1.9.jar'
  Could not parse POM https://mycompany.com/artifactory/repo/org/hamcrest/hamcrest-parent/1.1/hamcrest-parent-1.1.pom
            > Could not HEAD 'https://mycompany.com/artifactory/repo/org/hamcrest/hamcrest-parent/1.1/hamcrest-parent-1.1.jar'

So far all the errors are related to a parent POM file.

The strange thing here is that when I add ‘mavenCentral()’ to my repositories section, this doesn’t seem to be an issue.

Could someone please shed some light on whats going on? Thank you!


(Peter Niederwieser) #2

Are these actually errors? What’s the exact error message and stack trace (’–stacktrace’) you get, and what’s the output of ‘gradle -v’?


(Peter Niederwieser) #3

Also, you don’t want to put Maven repo definitions within an ‘ivy’ block (which defines an Ivy repository), and I don’t think you want to add the same Artifactory URL both as a Maven and an Ivy repository.


(Santoash Rajaram) #4

Thanks for the quick response!

Here is the stack trace after I changed the dependency block:

https://gist.github.com/scuddalo/8872776

Here is the new dependency block:

repositories {
    maven {
        url "https://mycompany.com/artifactory/repo/"
        credentials {
            username 'username'
            password 'password'
        }
    }
}

Here is the gradle -v output:

------------------------------------------------------------
Gradle 1.10
------------------------------------------------------------
  Build time:
 2013-12-17 09:28:15 UTC
Build number: none
Revision:
   36ced393628875ff15575fa03d16c1349ffe8bb6
  Groovy:
     1.8.6
Ant:
        Apache Ant(TM) version 1.9.2 compiled on July 8 2013
Ivy:
        2.2.0
JVM:
        1.6.0_65 (Apple Inc. 20.65-b04-462)
OS:
         Mac OS X 10.9.1 x86_64

(Peter Niederwieser) #5

What’s the output of ‘gradle -v’, and why do you add the same repo both as Maven and Ivy repository? (Please try removing either of the two.)


(Santoash Rajaram) #6

Sorry, I pasted the wrong thing. I updated it now.


(Peter Niederwieser) #7

Is this a single trace? The topmost exception seems to be missing (the trace already starts with “Caused by:”). Can you also add the full error message?


(Santoash Rajaram) #8

If I changed my dependency block to this:

repositories {
    mavenCentral()
      maven {
        url "https://mycompany.com/artifactory/repo/"
        credentials {
            username 'username'
            password 'password'
        }
    }
}

Then it seems to correctly ignore the parent pom error. Here is the output when gradle successfully ignored the error:

Download http://repo1.maven.org/maven2/org/fusesource/leveldbjni/leveldbjni-win64/1.5/leveldbjni-win64-1.5.pom
Found locally available resource with matching checksum: [http://repo1.maven.org/maven2/org/hamcrest/hamcrest-core/1.1/hamcrest-core-1.1.pom, /Users/rajaram/.gradle/caches/modules-2/files-2.1/org.hamcrest/hamcrest-core/1.1/fe8b54d8729315853ee866322436df89aa8ab9ae/hamcrest-core-1.1.pom]
Found locally available resource with matching checksum: [http://repo1.maven.org/maven2/org/hamcrest/hamcrest-parent/1.1/hamcrest-parent-1.1.pom, /Users/rajaram/.gradle/caches/modules-2/files-2.1/org.hamcrest/hamcrest-parent/1.1/31ef4ab73bb6d6173f46ecf92d6bd9047516c6ca/hamcrest-parent-1.1.pom]
Resource missing. [HTTP HEAD: http://repo1.maven.org/maven2/org/hamcrest/hamcrest-parent/1.1/hamcrest-parent-1.1.jar]

(Santoash Rajaram) #9

just added the full stack trace here: https://gist.github.com/scuddalo/8872776


(Santoash Rajaram) #10

Just added the full stacktrace here: https://gist.github.com/scuddalo/8872776


(Santoash Rajaram) #11

Also, as I mentioned already this error seems to go away if I run the same requests against mavenCentral(). Do you know if there is a special setting in mavenCentral() that allows gradle to ignore unresolved parent pom errors?


(Santoash Rajaram) #12

I still haven’t figured this out yet. Could someone please help clarify this? I would really appreciate it.


(Perryn Fowler) #13

Hi Santoash,

I suspect this might be a compatibility problem between Artifactory and our 1.10 release.

Things to try:

1 Change a setting in Artifactory

I suspect that you have [Admin -> Security -> General -> Hide Existence of Unauthorized Resources] unchecked. Try checking it (and hitting Save).

This may work… or you may find that it breaks resolution of all artifacts that require authentication.

2 Downgrade to Gradle 1.9

If the above does not work it would be interesting to see if the problem exists in Gradle 1.9 (remember to uncheck the Artifactory setting again)

3 Upgrade to a nightly build

I have recently made a change that should fix this issue. If you want, you can try it out by using our latest nightly build http://www.gradle.org/nightly

Please let me know how you go

Pez


(Perryn Fowler) #14

actually you may need to try 1.8 for step 2


(Santoash Rajaram) #15

Hi Perryn,

Thanks for looking into this. I just tried flipping the checkbox in my artifactory and that killed all the resources that required authentication. So I ended up trying 1.8 and Im still getting the same error.

Im going to give the nightly build a shot.

Is there a link to the other issue you mentioned?

Thanks!


(Santoash Rajaram) #16

Although, the nightly build did the trick!!

Do you happen to have the patch that actually fixed this issue? Im just trying not to be on the bleeding edge if possible.

Thanks again!


(Perryn Fowler) #17

Hi Santoash

Did you try 1.9?

Also can you tell me a little more about your Artifactory set up? Do you need authentication to get any resource from it or only a subset? Do you need to authenticate to get hamcrest?

The change in the nightly is https://github.com/gradle/gradle/commit/97fb925848249251129f7ea0d70f12bdf112f2d0#diff-3ffa84f7e62b25c96bbb151dfce10cbd but I’m not sure you would really want to build your own version of gradle?

I’d expect this change to be in the 1.12 release in a few weeks :slight_smile:


(Santoash Rajaram) #18

Yeah, 1.9 is broken as well.

Our artifactory needs auth only a subset of the resources. Most of the resources don’t need authentication and yes, I didn’t have to authenticate to get hamcrest.

Cool, I will live in the bleeding edge for now and keep an eye on that change to see when it makes it to 1.12.

Thanks again!