简体   繁体   中英

How to download artifacts from ivy repository using maven

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.

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM