How to ignore parent pom for dependency resolution?


(Aram Zamora) #1

How to ignore parent pom for dependency resolution? I have a dependency to a SNAPSHOT in the pom of this dependency there is a reference to a parent pom. If I build the project with maven it works fine, but using gradle it always tries to resolve the parent reference. Is there a way to ignore this? or a workaround? Can @Jar guess the latest version for the Snapshot?


How to deal with parent artifact with version RELEASE
#2

Gradle assumes that the parent pom has important information that is required to build the module definition. There’s not currently any way to disable this.

Does the parent pom file not exist? I’m curious how Maven deals with this case.


(Aram Zamora) #3

Hi, the parent does not exist in the repository. I have something like this in the pom.xml

<parent>
      <groupId>com.my.company</groupId>
      <artifactId>my-component</artifactId>
      <version>LATEST</version>
</parent>

The parent exists only in another repository and in the maven-metadata.xml the LATEST version is defined

<metadata>
     <groupId>com.my.company</groupId>
     <artifactId>my-component</artifactId>
     <versioning>
           <latest>1.0</latest>
           <release>1.0</release>
           <versions>
               <version>1.0</version>
           </versions>
           <lastUpdated>20130621113435</lastUpdated>
     </versioning>
</metadata>

If I try to build with gradle I get the following error: Could not resolve com.my.company:sub-component:1.0-SNAPSHOT.

Required by:

:trunk:0.0.1-SNAPSHOT

Could not find any version that matches com.my.company:my-component:LATEST.


#4

You say the parent exists in another repository? Is that repository included in your section?

There’s no way to tell Gradle not to load the parent pom. I’m guessing that Maven requires it to be loaded as well: but Maven must be finding the right repository to load it from.


(Aram Zamora) #5

Yes, the parent exists in another repository, and it is referenced, but with gradle the version of the parent “LATEST” cannot be resolved.

in build.gradle

repositories {
    mavenLocal()
    maven {
        url "http://repo.mycompany.com/public"
    }
    maven {
        url "http://repo.mycompany.com/public-snapshots"
    }
}