I've just started using Ivy, and I'm really struggling as I've found the documentation and tutorials on the Apache site to be very confusing and not relevant to how I want to use it.
I want to publish some jar files to a local Ivy repository using Ant. The Ant script creates four jar files:
- sed-ws-client.jar
- sed-ws-client-src.jar
- sed-enums.jar
- sed-enums-src.jar
These jars should end up in two different directories in the Ivy repository (e.g. a sed-ws-client
directory and a sed-enums
directory). The repository currently contains 0.0.1 and 0.0.2 versions of these jars in the appropriate directories, with corresponding ivy-[version].xml files (this was done manually).
I'm having a lot of trouble figuring out how to construct the "publish" Ant target and the project's ivy.xml
file. I'm forced to put a module name in the info
tag of the ivy.xml
file, but this would imply that I can only publish jars to one directory in the Ivy repository?
I've tried various things but the Ant build always fails. I just want a simple explanation of the steps I need to take to get it working. The repository structure can be changed if necessary.
Here's what I have so far:
ivy.xml
file:
<ivy-module version="1.0">
<info organisation="myorg" module="SED" revision="1.0" status="dev"></info>
<publications>
<!-- ws-client -->
<artifact name="sed-ws-client"/>
<artifact name="sed-ws-client" type="src"/>
<!-- generated -->
<artifact name="sed-enums"/>
<artifact name="sed-enums" type="src"/>
</publications>
</ivy-module>
Ant target:
<target name="ivy-publish" description="Produce the ivy.xml file for the built jars">
<ivy:settings file="d:/temp/ivy/ivysettings.xml" />
<ivy:retrieve />
<ivy:publish organisation="myorg" resolver="default" pubrevision="0.0.2" update="true">
<artifacts pattern="${DEPLOY_DIR}/${sed.ws.client.jar}-[type].[ext]" />
<artifacts pattern="${DEPLOY_DIR}/${sed.enums.jar}-[type].[ext]" />
</ivy:publish>
</target>