Search code examples
javawebsphereradivyivyde

Ivy libs in WAS deployment


I have a war attached to an ear in RAD. I'm using Ivy to manage my project dependencies. My only problem is that when I deploy the ear to my dev instance of WAS through RAD, the deployment doesn't see any dependent libraries from ivy. How can I configure the project so that the ivy dependencies show up when the project is deployed to websphere?


Solution

  • Ivy is used when building the WAR and EAR files.

    For example:

    <ivy:retrieve pattern="${lib.dir}/[artifact].[ext]"/>
    
    <war destfile="${war.file}" webxml="${resources.dir}/web.xml">
        <fileset dir="${resources.dir}" excludes="web.xml"/>
        <lib dir="${lib.dir}"/>
    </war>
    

    The retrieve command is used to populate a lib directory whose contents are copied into the WAR. (The lib tag ensures the jars are placed under WEB-INF/lib within the WAR)

    Update

    The ivy retrieve task can be run from the command line, if you just want to download dependencies to a local directory:

    java -jar ivy.jar -ivy ivy.xml -retrieve "lib/[artifact].[ext]"