I have a special situation where I need to package up some jars, and I need BOTH versions of a jar. My ivy definitions looks like this:
<dependency org="blah" name="blahname" rev="1.0.0" conf="baseline->default" />
I would like the same dependency resolved twice, once with version 1.0.0 and another with say version 2.0.0. Is that possible? What's the easiest way to achieve this.
Use ivy configurations to create and manage custom groups of dependencies.
<ivy-module version="2.0">
<info organisation="com.myspotontheweb" module="demo"/>
<configurations>
<conf name="group1" description="First group of dependencies"/>
<conf name="group2" description="Second group of dependencies"/>
</configurations>
<dependencies>
<dependency org="commons-lang" name="commons-lang" rev="2.6" conf="group1->default"/>
<dependency org="commons-lang" name="commons-lang" rev="2.0" conf="group2->default"/>
</dependencies>
</ivy-module>
<project name="demo" default="resolve" xmlns:ivy="antlib:org.apache.ivy.ant">
<target name="resolve">
<ivy:resolve/>
<ivy:retrieve pattern="lib/[conf]/[artifact]-[revision].[ext]"/>
</target>
</project>
Notes:
Lib directory is populated with the desired jars.
$ tree
.
|-- build.xml
|-- ivy.xml
`-- lib
|-- group1
| `-- commons-lang-2.6.jar
`-- group2
`-- commons-lang-2.0.jar
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With