The server keeps common Java libraries in a repository by using the same directory structure and naming conventions prompted by the Apache Maven project. If your Java EE asset depends on a library that is not already in the repository, you can update the repository to include the new library from the administration console or by using the deployer command, and define the dependency in your Java EE asset's deployment plan. This topic introduces how to add Java libraries to the Geronimo repository by using the Administration Console.
Update the repository with new library
For adding archives or jars to the repository, the Repository Viewer portlet is available by selecting Server > Repository on the Console Navigation menu on the left side. The Repository Viewer portlet illustrated in the following figure displays the artifacts installed in the server's repository. The layout of the repository is the same as that used by Apache Maven, which makes it possible to copy files over easily.
Here are the meaning for each field on the Repository Viewer portlet:
- File is the actual location of the archive.
- group is a group identifier, typically, the name of the open source project (for example commons-logging or log4j), or the directory tree matching the Java package prefix (for example org/apache/derby) of the organization that supplies the library.
- Artifact is the file name prefix of the library.
- Version is the version identifier of the library in the file, allowing the repository to hold multiple versions of the same library without ambiguity.
- Type is the type of file, typically, jar.
Define the dependency in the deployment plan
To avoid problems with trying to load the same native library more than once per jvm lifetime, you need to put the code that loads native libraries (such as many db drivers) into a classloader plugin that can be shared among all the datasource plugins that need the classes.
To use an artifact in an application, take the first artifact from the list as an example, you will need to add a <dependency> element under <dependencies> in the <environment> element in the application's deployment plan. Here is an excerpt of how a deployment plan would look like:
Besides using the administration console to add an archive into the Geronimo repository, you can do the same thing by using the