JAM uses Maven's repository to automatically download, store and to track versioned dependencies. Whenever you use the JAM plugin, Maven checks the local repository for each declared dependency and version. If a library file is not found, Maven automatically attempts to download it from its central repository. The trick is setting up the POM (project.xml) file with the correct library names and versions so Maven will recognize the file.
There are three ways to add jar or other dependency file to your JAM project:
| Central Repository | First browse the central
repository at http://ibiblio.org/maven
to see if the file you need is already available. If it is, note the name, subdirectory and version, then
make a dependency entry in your POM file (see POM Example) and regenerate your
classpath (maven jam). If you got the name right, the library will automatically be
downloaded into your local repository when you regenerate your classpath.
|
|---|---|
| Manual Placement in Local Repository | If the library you need is not in the central repository, you have to enter it manually into your local repository, see J2EE Library Installation for an example. |
| lib Directory | Although not recommended, you can place jar dependencies into a
directory named lib. Jar files found here will be included in the classpath and packaged
into war and ear files.
|
JAM sets maven.repo to Maven's maven.repo.local settings in the generated property
files. To override this setting see props-user.xml.
To change Maven's local or remote repository settings you need to modify one of Maven's property files. To make the changes globaly you utilize the ${user.home}/build.properties file which looks something like this:
## ----------------------------------------------------------
## Maven Global Properties - ${user.home}/build.properties
## ----------------------------------------------------------
## proxy settings: ------------------------------------------
# maven.proxy.host=my.proxyserver.com
# maven.proxy.port=8080
# maven.proxy.username=username
# maven.proxy.password=password
## repositories: --------------------------------------------
# maven.repo.remote=http://www.ibiblio.org/maven/,http://www.javagen.org/maven/
# maven.repo.local=/repository
## maven ant plugin: ------------------------------------------------
# The following setting is recommended to avert disaster when using
# JAM. If you type 'maven ant' instead of 'maven jam' your build.xml
# file will be overwritten along with all your hours of hard work.
maven.ant.generatebuild.file=${basedir}/ant-plugin-build.xmlNote you can list more than one remote repository to search. Also highly recomended is changing the
maven.ant.generatebuild.file property for reasons stated above.
Besides the primary remote repository at http://ibiblio.org/maven, mirrors are available at: