Gradle fails to parse a org.hornetq:hornetq-native:2.4.0.Final pom


(Ivan Korobkov) #1

Gradle (tested 1.9 and 1.10) fails to parse a pom

Could not resolve all dependencies for configuration ':compile'.
> Could not resolve org.hornetq:hornetq-native:2.4.0.Final.
  Required by:
      :test:unspecified
   > Could not parse POM http://repo1.maven.org/maven2/org/hornetq/hornetq-native/2.4.0.Final/hornetq-native-2.4.0.Final.pom
      > Illegal character in path at index 97: http://repo1.maven.org/maven2/org/hornetq/hornetq-native/2.4.0.Final/hornetq-native-2.4.0.Final.${native-package-type}

Maven parses it successfully.

build.gradle

apply plugin: 'java'
  repositories {
    mavenCentral()
}
  dependencies {
    compile "org.hornetq:hornetq-native:2.4.0.Final"
}

gradle -version

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.7.0_45 (Oracle Corporation 24.45-b08)
OS:
         Mac OS X 10.9.1 x86_64

(Ivan Korobkov) #2

It seems, Gradle does not expand the property ‘${native-package-type}’ defined at the pom bottom when downloading the artifact.


(Peter Niederwieser) #3

Publishing POMs that haven’t had their profiles resolved is heavily discouraged, even by the Maven (Central) folks. Unfortunately, I’m not aware of a way to use such POMs from Gradle. If you have an internal repository, the best solution is to fix up the POM there.


(Benjamin Muschko) #4

I believe this is happening because the Gradle POM parsing doesn’t take into account property replacement for the ‘packaging’ attribute. A value for the property ‘native-package-type’ is also defined outside of a profile so this should generally work.

<project>
    ...
    <packaging>${native-package-type}</packaging>
        ...
    <properties>
        <native-package-type>jar</native-package-type>
    </properties>
</project>

I raised an issue.


(Ivan Korobkov) #5

Great. Thanks.


(Benjamin Muschko) #6

This has been fixed for Gradle 2.1. You’ll be able to try this out with one of the nightly builds after the 2.0 final release.


(Ivan Korobkov) #7

It’s great. Thanks. I’ll try it out.