header

Torsten Curdt’s weblog

Converting maven pom to ivy

Without making any comments about metadata formats or simplicity vs complexity of dependency defintions… Here is how you can convert a maven pom into an ivy.xml if required. Just create a very basic ant file and execute it:

<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>

One would hope there was an ordinary command line for this.

Thanks to Nicolas for pointing me to this!

  • Shadarap
    Thanks for the post :)
  • stuartblair
    Thankyou soooooo much! It worked a treat.
  • kalyan
    Thanks @ Matt & tcurdt. I think it will run in the ivy versions >= 2.0
  • Matt
    Here's the way to do it : http://ant.apache.org/ivy/hist...
  • @kalyan: I don't know of any. And frankly speaking I doubt that's easily doable.
  • kalyan
    Hi,
    Is there any automated converter which coverts IVY.xml to Maven Pom
  • Jan
    Ok, now it works. Nested elements and AntLibs are supported. You could try the sandbox/javafront and start

    ant ^
    -lib build\classes -lib _ivy ^
    -main org.apache.ant.javafront.TaskExec ^
    -xmlns:ivy=antlib:org.apache.ivy.ant ^
    ivy:convertpom pomFile pom.xml ivyFile ivy.xml
  • Jan
    Nice idea - we have developed something to start tasks from the command line. But for your use case there is one thing open: the use of AntLibs and the need for registration of that tasks. The other open thing is the use of nested elements like s.
  • TheGuru
    Thanks for sharing that, it will come in very handy for this ivy convert.
blog comments powered by Disqus