Adding JARs to an Application

How do you tell Sakai/Tomcat where to look for some .jar files that I've added?

I've figured out how to do this in maven, but they're not automatically linked when it is built.

Glenn Golden replies

The best way to handle jar files is to include them in your .war file, using the maven option to do so. If the jar is used by something other than your tool, you can have it deployed to tomcat's shared/lib or common/lib as appropriate. In sakai2, if the jar is needed by the API implementation packaged in a components package, this is like a war and the jar file can be included in the .war in the same way.

Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.
  1. May 12, 2005

    Steven Githens says:

    Example: I had to add the following jars to my project: jurt.jar unoil.jar ridl....

    Example:

    I had to add the following jars to my project:

    jurt.jar
    unoil.jar
    ridl.jar
    juh.jar

    It seems like maven always wants to use a version number, so I renamed them to:

    jurt-2.0.jar
    unoil-2.0.jar
    ridl-2.0.jar
    juh-2.0.jar

    Then I made a directory in the ~/.maven/repository called oo2/jars

    ~/.maven/repository/oo2/jars

    and copied the four jars there.

    Then added the following entries to the project.xml

    <dependency>
    	<groupId>oo2</groupId>
    	<artifactId>jurt</artifactId>
    	<version>2.0</version>
    	<properties>
    	    <war.bundle>true</war.bundle>
    	</properties>
    </dependency>
    		
    <dependency>
    	<groupId>oo2</groupId>
    	<artifactId>unoil</artifactId>
    	<version>2.0</version>
    	<properties>
    		<war.bundle>true</war.bundle>
    	</properties>
    </dependency>
    		
    <dependency>
    	<groupId>oo2</groupId>
    	<artifactId>ridl</artifactId>
    	<version>2.0</version>
    	<properties>
    		<war.bundle>true</war.bundle>
    	</properties>
    </dependency>
    		
    <dependency>
    	<groupId>oo2</groupId>
    	<artifactId>juh</artifactId>
    	<version>2.0</version>
    	<properties>
    		<war.bundle>true</war.bundle>
    	</properties>
    </dependency>

    And everything built and ran OK.