Ce contenu n'est pas disponible dans la langue sélectionnée.

Chapter 4. Locating Artifacts with Maven and HTTP


Abstract

In Red Hat JBoss Fuse, Maven is the primary mechanism for locating artifacts and dependencies, both at build time and at run time. Normally, Maven requires Internet connectivity, so that dependencies can be downloaded from remote repositories on demand. But, as explained here, it is also possible to provide dependencies locally, so that the need for Internet connectivity is reduced.

4.1. Locating HTTP Artifacts

Overview

You can specify the location of an OSGi bundle (and other kinds of resource) using a HTTP URL—for example, by specifying a HTTP URL as the argument to the osgi:install command. This approach is perhaps not as common as using Maven URLs, but it means that you have the option of providing OSGi resources through a Web server.

HTTP URL protocol

The HTTP URL protocol specifies the location of an OSGi bundle (or other resource) using a standard HTTP (or HTTPS) URL. Typically, a HTTP URL has a syntax like the following:
http[s]:Host[:Port]/[Path][#AnchorName][?Query]
In a standalone (non-Fabric) container, a HTTP URL lookup can be triggered by either of the following events:
  • When osgi:install is invoked on a Maven URL to install an OSGi bundle;
  • When features:install is invoked to install a Karaf feature (a Karaf feature typically includes one or more Maven URL references).

HTTP URL handler

JBoss Fuse uses Java's built-in HTTP protocol handler to resolve HTTP URLs. Hence, HTTP URL resolution behaves exactly as you would expect in standard Java.

Karaf bundle cache

When you pass a HTTP URL as the argument to the osgi:install command (or embedded in a Karaf feature description), JBoss Fuse downloads the referenced OSGi bundle resource, saves it in the Karaf bundle cache (under the data/cache directory), and loads the bundle into the Karaf container runtime. The Karaf bundle cache is used to persist all of the bundles currently installed in the Karaf runtime.
Note
When a Karaf container is stopped and restarted, it loads its installed bundles directly from the Karaf bundle cache, not from the local Maven repository (or anywhere else). Hence, if you have updated any artifacts in the local Maven repository in the meantime, those changes are not automatically reflected in the state of the Karaf container.

Configuring a HTTP proxy for HTTP URLs

To configure a HTTP proxy (which will be used when resolving HTTP URLs), open the InstallDir/etc/system.properties file in a text editor and set the http.proxyHost and http.proxyPort system properties with the host and port of the proxy—for example:
http.proxyHost=192.0.2.0
http.proxyPort=8080
You can optionally specify a list of non-proxy hosts (hosts that can be reached without going through the proxy) using the http.nonProxyHosts property—for example:
http.nonProxyHosts=localhost|*.redhat.com|*.jboss.org
Note
An advantage of using the system properties approach to configuring the proxy is that these settings will be used both by the mvn URL protocol handler and by the http URL protocol handler (see the section called “Configuring a HTTP proxy for Maven URLs”).
Red Hat logoGithubRedditYoutubeTwitter

Apprendre

Essayez, achetez et vendez

Communautés

À propos de la documentation Red Hat

Nous aidons les utilisateurs de Red Hat à innover et à atteindre leurs objectifs grâce à nos produits et services avec un contenu auquel ils peuvent faire confiance.

Rendre l’open source plus inclusif

Red Hat s'engage à remplacer le langage problématique dans notre code, notre documentation et nos propriétés Web. Pour plus de détails, consultez leBlog Red Hat.

À propos de Red Hat

Nous proposons des solutions renforcées qui facilitent le travail des entreprises sur plusieurs plates-formes et environnements, du centre de données central à la périphérie du réseau.

© 2024 Red Hat, Inc.