Dashboard > WOProject / WOLips > ... > Tutorials > Add a Jar Dependency
  WOProject / WOLips Log In View a printable version of the current page.  
  Add a Jar Dependency
Added by Lachlan Deck, last edited by Pascal Robert on Dec 15, 2007  (view change)
Labels: 

You'll often need to work with 3rd party Jars, as well as your own reusable code.

Adding these to your project is very simple.

  1. By default WOLips will create a Libraries folder in your project directory. Populate this with any jars you like.
  2. In Eclipse, right-click (or ctrl-click) on the jar and choose Build Path > Add to Build Path. This simple adjusts your project classpath but doesn't affect your final build.
  3. For frameworks, you should turn on the Export checkbox in the build path window as hown below in Fig. 1. Doing so ensures that other WebObjects projects the reference the framework "see" the jar library in their Eclipse build path.
    Fig. 1 Export jars when in a framework

  4. Adjust your build.xml file to ensure that the jar is also embedded in Contents/Resources/Java directory of the final build as below.

Either add an include entry for each jar...

<target name="build.woapp" depends="setProps,init.build,compile">
    <...>
        <lib dir="Libraries">
            <include name="Add .jar's that should be copied in the woa."/>
            <exclude name="**/*.woa/**"/>
        </lib>
    </woapplication>
</target>

... or have a single <include name="*/.jar"/> to include all jars in the specified directory.

Does Step 4 is needed when you put your jars into the Libraries folder ?

Site running on a free Atlassian Confluence Open Source Project License granted to ObjectStyle. Evaluate Confluence today.
Powered by Atlassian Confluence, the Enterprise Wiki. (Version: 2.5.4 Build:#809 Jun 12, 2007) - Bug/feature request - Contact Administrators