问题
Is there a maven plugin which i can use to convert the maven pom dependencies including transitive dependencies to an ivy.xml file?
回答1:
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)
回答2:
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>
回答3:
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.
来源:https://stackoverflow.com/questions/3715811/maven-pom-dependencies-to-ivy-xml-file