This section explains how the Fuse ESB container locates artifacts at run time. The container strikes a balance between accessing artifacts locally and downloading artifacts from remote repositories: all of the features installed by default are provided locally, in the system repository; whereas non-default features are downloaded from remote repositories the first time they are used. Figure 11.2 shows an overview of the procedure that Fuse ESB follows when locating artifacts at run time.
Whenever a feature is installed (using features:install
) or a Maven
artifact is installed (using osgi:install
) at run time, the Fuse ESB container
locates the required Maven artifacts as follows:MvnURL
The first place the container looks for artifacts is the system repository, which contains all of the artifacts (bundles, features, and so on) provided with the standard Fuse ESB installation. The system repository is located at
.EsbInstallDir
/systemIf an artifact is not available in the system repository, the container searches any other configured default repositories. In practice, this could be a custom repository.
If the artifact is not available in the system or default repositories, the container searches the Maven local repository. The default location of the local repository is the
.m2/repository/
directory under the user's home directory.If the artifact is not available in the system, default, or local repositories, the next repositories to try are the remote repositories (which are specified in the Fuse ESB configuration file,
etc/org.ops4j.pax.url.mvn.cfg
).If an artifact is found in a remote repository, it is automatically downloaded and installed into the local repository.
You can configure the following kinds of repository for locating Maven artifacts at run time:
The default repositories are always checked first. After installing Fuse ESB, the
list of default repositories contains just a single entry, for the Fuse ESB system
repository. For example, the etc/org.ops4j.pax.url.mvn.cfg
file
contains the following setting to configure the default repository list:
org.ops4j.pax.url.mvn.defaultRepositories=file:${karaf.home}/${karaf.default.repository}@snapshots
The defaultRepositories
property takes a comma-separated list,
enabling you to specify multiple default repositories. You can specify the
repository location using a URL with a file:
, http:
, or
https:
scheme and you can optionally add the
@snapshots
suffix to allow snapshot versions to be read from the
repository.
The container resolves the location of the local repository, by checking the following settings:
The location specified by the
localRepository
element in the Maven settings file, whose location is specified by theorg.ops4j.pax.url.mvn.settings
property in theetc/org.ops4j.pax.url.mvn.cfg
file.Otherwise, the location specified by the
localRepository
element in the~/.m2/settings.xml
file (UNIX and Linux) orC:\Documents and Settings\
(Windows).UserName
\.m2\settings.xmlOtherwise, the location specified by the
localRepository
element in the
file.M2_HOME
/conf/settings.xmlOtherwise, the default location is under the user's home directory,
~/.m2/repository/
(UNIX and Linux) orC:\Documents and Settings\
(Windows).UserName
\.m2\repository
The remote repositories checked by the container are specified by the
org.ops4j.pax.url.mvn.repositories
property in the
etc/org.ops4j.pax.url.mvn.cfg
file. The repositories are specified
in the form of a comma-separated list—for example:
org.ops4j.pax.url.mvn.repositories= \ http://repo1.maven.org/maven2, \ http://repo.fusesource.com/maven2, \ http://repo.fusesource.com/maven2-snapshot@snapshots@noreleases, \ http://repo.fusesource.com/nexus/content/repositories/releases, \ http://repo.fusesource.com/nexus/content/repositories/snapshots@snapshots@noreleases, \ http://repository.apache.org/content/groups/snapshots-group@snapshots@noreleases, \ http://repository.ops4j.org/maven2, \ http://svn.apache.org/repos/asf/servicemix/m2-repo, \ http://repository.springsource.com/maven/bundles/release, \ http://repository.springsource.com/maven/bundles/external
A repository URL in this list can optionally include one or more of the following suffixes:
@snapshot
Snapshot versions can be downloaded from this repository.
@noreleases
Release versions cannot be downloaded from this repository.