How to download artifacts from ivy repository using maven
Asked Answered
B

2

8

We are moving from ivy to maven. We have lots of artifacts in artifactory which were published using ivy and hence the artifact folder/path structure is similar to

  1. artifactory/libs-release/[organization]/[module]/[revision]/[type]s/[module](-[classifier]).[ext]

  2. artifactory/libs-release/[organization]/[module]/[revision]/[type]s/ivy.xml

However, when we add the dependency in maven pom.xml , the dependency name will be something like com.abc.xyz. But maven tries to look into the path com/abc/xyz/ folder whereas we have the artifact in artifactory in com.abc.xyz/my-artifact/1.0.0/jars/my-artifact.jar

How can I tell maven (pom.xml) to read and understand the path which is in artifactory.

I tried using ivy-maven-plugin but it gives classNotFound error for some groovy class even though I have required groovy jars in my local m2 repository folder.

* Answer ok, here is what we did. We created folders manually and then we are now using makepom plugin to convert ivy.xml to maven pom.xml Thank you to all your suggestions and more are welcome.

Birthday answered 10/10, 2012 at 12:0 Comment(3)
can you change the repository layout to a maven 2 layout or create a virtual layout? wiki.jfrog.org/confluence/display/RTF/Repository+LayoutsSalchunas
Agreed changing the layout is the best approach. Ivy supports Maven, unfortunately not the other way round :-)Krum
Thx oers and Mark. We wanted to avoid changing the repository layout as we are in the middle of the development cycle now and also there are lots of components developed by other teams as well. So, we were skeptical about breaking their builds.Birthday
G
4

Why would you try to fit Maven into Ivy. Ivy was there to utilize and mimic what Maven already have at that time.

Since Ivy can read Maven repository but not the other way around, I would suggest you to setup your own local network (or company) Maven repository, either using Nexus or Artifactory. Then you can upload the artifact there one by one, and the standardize those Ivy build to point to that new Maven repository. This takes some additional efforts at the beginning, but I believe it will pay up later.

There is another option, configure Maven to read non-standard repository layout, but why would you want to go that route? Everything will be much more difficult once you choose this path.

Gamesmanship answered 13/10, 2012 at 14:13 Comment(2)
Thank you. We found that maven documentation as compared with ivy. Also in some of the other tools/etc, like for example, Artifactory, they always give examples of Maven but not so much on ivy. We had struggled a bit to get ivy and artifactory working evening though we started using ivy right from the beginning of our project. So, we decided to move to maven. I had used maven in my past companies and I have seen it work much better with good documentation available.Birthday
OK. It seems Maven is more mainstream that it will be easier for you to find help when you bump into problems.Gamesmanship
B
3

Take a look at my Ivy integration package. The jar.macro is especially convenient because it automatically builds the pom.xml as you build the jar. The macro is very similar to the jar task.

What I do is build pom.xml with each of my jars, then use mvn deploy:deploy-file to deploy my jars to the Maven repository.

mvn deploy:deploy-file -Dfile=$jar_file
    -D pomFile=pom.xml
    -D repositoryId=$repo_id
    -D url=$repo_url
Boneblack answered 23/11, 2012 at 18:2 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.