How to specify a maven 1 repository


(hw.kirk) #1

I am trying to resolve gradle dependencies that are already stored in a maven ONE repository.

Maven 1 stores them in the format below, but this does not work.

  • What went wrong: Execution failed for task ‘:dependencies’. Cause: Could not resolve all dependencies for configuration ‘:compile’. Cause: Could not resolve group:spectrum, module:app-spectrum-base, version:head-SNAPSHOT. Required by:

spectrum-license:license-generator:1.0 Cause: Invalid uri ‘http://spectrum.shawsystems.com/maven/[group]/xmls/ivy-head-SNAPSHOT.xml’: escaped absolute path not valid

Does anyone know how to resolve maven 1 dependencies? repositories {

ivy {

url “http://spectrum.systems.com/maven

layout ‘pattern’ , {

artifact ‘[group]/[ext]s/[artifact]-[revision].[ext]’

}

} }


#2

You need to use ‘organisation’, not ‘group’ in your pattern. That’s what’s causing the exception you’re reporting.

Gradle doesn’t currently support resolution against a Maven 1 repository. By declaring an ‘ivy’ repository, you’re telling Gradle to first look for an ivy.xml file, then for a jar file. Since there won’t be any ivy.xml present (and Gradle won’t be looking for the Maven 1 project.xml) you’ll be missing out on any transitive dependency information but you should be able to resolve the jar artifacts.

Unfortunately, there’s not really a better way to handle Maven 1 repositories at this time. You could possibly configure an ivy IbiblioResolver directly, but this is not a preferred way of constructing a repository.


(hw.kirk) #3

Thank you very much!!

I switched to ‘organisation’ and the maven 1 dependencies resolved ok.

We are a small/midsize software shop with lots of maven 1 investment finally looking to move to gradle.

I am happy to re-code the dependencies in gradle and don’t care about the project.xml,

as long as the M1 artifacts can be resolved.

So far so good.

Thanks again!

repositories {

ivy { // maven 1 format ?

url “http://spectrum.shawsystems.com/maven

artifactPattern “http://spectrum.shawsystems.com/maven/[organisation]/[ext]s/[artifact]-[revision].[ext]”

} }


#4

One thing you might want to consider is fronting your existing maven1 repository with a repository manager like Artifactory or Nexus. I believe that Artifactory understands Maven 1 repositories and can provide a Maven 2 compatible view of these repositories.