Resolving artifacts without POM/IVY file (gradle 6)

Hi,

I’m currently evaluating nightly builds of gradle 6 (6.0-20191006230018+0000) to support Java 13 and am facing some issues in resolving artifacts with missing metadata in the repository. That is maven artifacts without POM or ivy artifacts without ivy.xml are not resolved anymore. With 5.4 this has not been an issue…

Is this desired behavior or due to the “in development” status of the 6.0 release?

Additionally I noticed that gradle went into what looked like an endless loop (at least it took more than 10 minutes before I aborted the build), if some repository servers are not reachable. I used https for out internal repository instead of http and gradle kept on trying to resolve IVY artifacts over and over again.

I have found the same problem using Gradle 6.2.2. I am attempting to resolve artifacts via IVY, however some do not have an ivy.xml file.

How does one resolve such artifacts? I am attempting to do a POC to adopt Gradle as our build tool, moving away from ANT/IVY, however this is a pretty big blocker for me if I cannot resolve existing dependencies.

Thanks.

You should try to add

metadataSources {
  artifact()
}

to your IVY repository declaration.

Thanks… is there a way to configure that per dependency? I have a number of dependencies that are effectively just pull down the jar, like so:

<dependency org="myOrg" name="artifactName" rev="1.0.0.release.19" transitive="false"  conf="build,runtime">
      <artifact name="artifactName" type="jar" />
</dependency>

However, there are other dependencies where the transitive property should be taken into account and I also need a way to specify the Ivy configuration for those dependencies. I’m not seeing a way to do this with Gradle yet.

Thanks.

I don’t think you can specify this on an artifact level. You can however add multiple metadata sources:

metadataSources {
  ivyDescriptor();
  artifact();
}

This way gradle will first look for an ivy XML and - if not found - extract meta data from the respective artifact itself. The order of metadata sources in the above declaration doesn’t matter. The sources will always be checked in a predefined order (see https://docs.gradle.org/current/userguide/declaring_repositories.html#sec:supported_metadata_sources):

Metadata source Description Order Maven Ivy / flat dir
gradleMetadata() Look for Gradle .module files 1st yes yes
mavenPom() Look for Maven .pom files 2nd yes yes
ivyDescriptor() Look for ivy.xml files 2nd no yes
artifact() Look directly for artifact 3rd yes yes