|
| Home > Apache Geronimo v3.0 > Documentation > Developing > Tutorials > Getting familiar with the development environment > Using shared libraries in your applications |
The server provides a common directory where you can install class files and JAR files that can be shared by multiple Java EE assets. Although the shared library may not be suitable for production environments, it may be a convenient place to keep classes or libraries while you are developing your Java EE asset.
You can use a reference class to the gbean org.apache.geronimo.system.sharedlib.SharedLib so that you can use shared libraries in your applications. By default, you may put all your libraries and classes files under <Geronimo_HOME>/var/shared directory, then add a dependency to deployment plan of your application as followed.
... <environment> <dependencies> <dependency> <groupId>org.apache.geronimo.configs</groupId> <artifactId>sharedlib</artifactId> </dependency> </dependencies> ... </environment> ...
You can also specify another directory rather than the default <Geronimo_HOME>/var/shared directory for libraries sharing. Use the following code snippet in your deployment plan when referring to a relative path:
... <gbean name="SharedLib1" class="org.apache.geronimo.system.sharedlib.SharedLib"> <attribute name="baseDir">var/shared</attribute> <attribute name="classesDirs">classes</attribute> <attribute name="libDirs">lib</attribute> <reference name="ServerInfo"> <name>ServerInfo</name> </reference> </gbean> ...
or the following code snippet when referring to an absolute path:
... <gbean name="SharedLib1" class="org.apache.geronimo.system.sharedlib.SharedLib"> <attribute name="baseDir">c:/mySharedLib</attribute> <attribute name="classesDirs">classes</attribute> <attribute name="libDirs">lib</attribute> <reference name="ServerInfo"> <name>ServerInfo</name> </reference> </gbean> ...
|
|
Privacy Policy - Copyright © 2003-2013, The Apache Software Foundation, Licensed under ASL 2.0. |