3

Our Ivy repo is set up as described here: http://ant.apache.org/ivy/history/latest-milestone/terminology.html

I'm attempting to access it from maven. The paths map to the module no problem. We have a module foo, and then foo creates artifacts foo-api.2.1.0.jar and foo.2.1.0.jar (the implementation). Its the foo-api.2.1.0.jar that is the problem.

I've tried the maven classifier, but then it wants to find foo.2.1.0-api.jar, not foo-api.2.1.0.jar.

The diagram in the link implies that an ivy.xml or pom.xml could create the example layout they have for mymod-api, mymod-impl. How does one do that with a pom?

Update:

A suggestion was to make the maven artifacts be mymod-api and mymod-impl, but this then has maven query the repo for:

  /com/mycorp/foo-api/2.1.0.0/foo-api.jar
  /com/mycorp/foo/2.1.0.0/foo.jar

Whereas Ivy puts them:

  /com/mycorp/foo/2.1.0.0/foo-api.jar
  /com/mycorp/foo/2.1.0.0/foo.jar

Consequently, just using maven artifacts renders them undiscoverable.

Update 2:

We are using the Nexus repo manager.

2
  • It would be simpler to use a Maven repository manager like Nexus to manage artifacts for you. It's very lightweight, only uses filesystem (no DB) and more importantly is standards compliant. I use it all the time for both Maven and Ivy projects Dec 4, 2012 at 19:41
  • We are using Nexus. How are you mapping Ivy artifacts to Maven artifacts? What is your resolver config for Ivy?
    – jamie
    Dec 4, 2012 at 19:50

2 Answers 2

1

You don't want the classifier, that'll do what you said. What you need is that the artifact id to be "foo-api" for that artifact. It's not a problem, it's working as intended.

0
1

If you are using Nexus, as your repository manager, then check out this answer on how to configure your ivy build:

Use public maven repository with ivy

Update1

Publishing files to Nexus from ivy is described here:

how to publish 3rdparty artifacts with ivy and nexus

Apologies in advance, it's very comprehensive and will also explain the significance of classifiers in Maven.

Update2

When publishing to Nexus:

<ivy:publish resolver="deploy"...>
    <artifacts pattern="${build.dr}/[artifact](-[classifier]).[ext]"/>
</ivy:publish>

make sure you're using an ibilio resolver:

<ivysettings>
    <settings defaultResolver="central"/>
    <credentials host="somehost" realm="Sonatype Nexus Repository Manager" username="????" passwd="????"/>
    <resolvers>
        <ibiblio name="central" m2compatible="true"/>
        <ibiblio name="deploy" root="http://somehost/nexus/content/repositories/repo" m2compatible="true"/>
    </resolvers>
</ivysettings>

The "gotcha" is m2compatible="true". For historical reasons the resolver supports the much older Maven 1 respository format (Ibilio is the old name for Maven Central).

7
  • 1
    I've got a Nexus repo full of Ivy builds that I need to access via Maven. That post is about a Nexus repo full of Maven builds that they need to access through Ivy.
    – jamie
    Dec 4, 2012 at 20:19
  • @jamie Ok, now you're really confusing me... Nexus is a Maven repository manager, by definition that means it's designed to support Maven clients.... How are you publishing content to the repository? I've updated my answer Dec 4, 2012 at 20:51
  • We're using is as an Ivy repo. We're publishing to it using <ivy:publish> in our ant files. Nexus doesn't really care where you put things, it just wants a path. And ivy doesn't care where you put things, it just wants an artifact pattern. Maven, however, unless someone can tell me otherwise, demands artifacts be on a specific path. I'm beginning to think that the only solution is to move our files around in Nexus, and modify our ivy resolvers to match maven.
    – jamie
    Dec 4, 2012 at 21:34
  • @jamie Ahhh, now I understand. Apologies I thought Nexus would do some checking on the format of the posted artifact... Clearly not :-( If you read the detail of my other answer you'll notice that I'm using the ibilio resolver when publishing artifacts. This ensures the publish task is Maven compliant. Dec 4, 2012 at 22:26
  • @jamie And yes, the Maven client is very picky and offers no flexibility in respository layout.... That is both good and bad... Using the ibilio resolver is ivy's way of emulating that inflexibility :-) Dec 4, 2012 at 22:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.