Maven POM dependencies to ivy.xml file
Asked Answered
P

3

8

Is there a maven plugin which i can use to convert the maven pom dependencies including transitive dependencies to an ivy.xml file?

Primrose answered 15/9, 2010 at 8:16 Comment(2)
Yes i am aware of the fr.jayasoft.ivy.ant Ant task, however i am looking for a maven plugin!Primrose
What's the usecase? I'm a big fan of ivy but spend most of my time integrating it with Maven technologies, not the other way around :-)Pearlinepearlman
F
7

Here's an Ant script

<project name="convertPomToIvy" basedir="." default="all"
  xmlns:ivy="antlib:fr.jayasoft.ivy.ant"
  xmlns:ac="antlib:net.sf.antcontrib">

    <path id="antlib.classpath">
        <fileset dir="/path/to/ivy/libs" includes="*.jar"/>
    </path>

    <taskdef uri="antlib:fr.jayasoft.ivy.ant"
        resource="fr/jayasoft/ivy/ant/antlib.xml"
        classpathref="antlib.classpath"
        loaderref="antlib.classpath.loader"/>

    <target name="convert">
        <ivy:convertpom pomFile="pom.xml" ivyFile="ivy.xml" />
    </target>

</project>

From here or here (& probably elsewhere)

Fillian answered 15/9, 2010 at 8:24 Comment(0)
R
7

I feel it is better to depend solely on apache as much as possible. So here is the ant build file which I ran successfully.

Just one line is required as specified in http://ant.apache.org/ivy/history/trunk/use/convertpom.html.

<project
  name="convertPomToIvy"
  basedir="." default="all"
  xmlns:ivy="antlib:org.apache.ivy.ant">

    <target name="convert">
        <ivy:convertpom pomFile="pom.xml" ivyFile="ivy.xml" />
    </target>
</project>
Roxieroxine answered 28/8, 2012 at 22:34 Comment(4)
You might want to tell how you would run this. Lots of people have heard of ant, but many of us have tried very hard to avoid having to learn or use it. (I just got "BUILD FAILED /Users/james/workspace/JavaSignatureParser/foo.xml:7: Problem: failed to create task or type antlib:org.apache.ivy.ant:convertpom Cause: The name is undefined." when I tried the obvious "ant -f foo.xml convert" - but I don't know or care much about ant...)Cashandcarry
If you have to use Ivy, you have to use Ant. Teaching how to use Ant is beyond the scope here. AFA anyone who have used Ant, they would simply run the ant file from eclipse.Roxieroxine
Follow the link I provided for org.apache.ivy.ant.Roxieroxine
You can use ivy config files without using ivy itself. sbt, for one, can read ivy files, so I've happily used ivy configurations without ever caring about ant. You can also use ivy configurations in the ivy eclipse container just for doing dependency resolution, no ant involved.Cashandcarry
E
1

According to Ivy 1.3-RC1 Changelog

NEW: maven2 pom compatibility: most resolvers are now able to handle m2 pom as project metadata and there is a new convertpom task able to convert a pom file to an ivy file (IVY-140)

This transformation is explained with moire details in this blog post.

I known it's not the maven, but the Ivy side, but anyway it seems to exist something, no ? It "should" be possible to convert the code (available on the web) to a maven plugin to have this transformation directed by maven, if you wish so.

Ertha answered 15/9, 2010 at 8:24 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.