Chapter 12. Configuring a Fabric's Maven Proxy


Abstract

The Fabric Ensemble creates a Maven proxy to access the repositories from which artifacts are distributed to the fabric's containers. You can modify the default settings to use a different set of repositories or make an internal repository accessible.

Overview

The Fabric Ensemble creates a Maven proxy to facilitate access to the artifacts required by the containers in the fabric. Each Fabric Server deployed in the fabric runs an instance of a Maven proxy. The ensemble aggregates all of the proxies so that it appears to the Fabric Agents as a single Maven proxy.
The Fabric Agents use the fabric's Maven proxy to access the known repositories. This ensures that all of the containers use the same set of repositories and artifacts.
Note
Advanced users can configure each Fabric server to act as a proxy for a different set of repositories. However, this is not a recommended set up.
Note
Fuse Management Console provides tooling for uploading bundles using the Maven proxy. You can also add the fabric's Maven Proxy to a POM file so that bundles can be distributed to the ensemble as part of an automated build process.

Default repositories

By default a fabric's Maven proxy is configured to be a proxy for the following Maven repositories:
  • Maven Central (http://repo1.maven.org/maven2)
  • Fuse Public (https://repo.fusesource.com/nexus/content/groups/public)
  • Fuse Releases (https://repo.fusesource.com/nexus/content/repositories/releases)
  • Fuse Early Access (https://repo.fusesource.com/nexus/content/groups/ea)
  • JBoss Public (https://repository.jboss.org/nexus/content/repositories/public)
  • SpringSource (http://repository.springsource.com/maven/bundles/release, http://repository.springsource.com/maven/bundles/external)
  • User's Local (~/.m2/repository)

Changing the repositories

To change the repositories the ensemble proxies:
  1. Create a new profile version. From the command console this is done using the fabric:version-create command. See section "fabric:version-create" in "Console Reference" for more information.
  2. Change the org.ops4j.pax.url.mvn.repositories property in the io.fabric8.agent PID of the default profile. Example 12.1, “Configuring the Maven Proxy URL” shows the console command for editing this property.

    Example 12.1. Configuring the Maven Proxy URL

    JBossFuse:karaf@root> fabric:profile-edit -p io.fabric8.agent/org.ops4j.pax.url.mvn.repositories = file:${runtime.home}/${karaf.default.repository}@snapshots@id=karaf-default, file:${runtime.data}/maven/upload@snapshots@id=fabric-upload, http://repo1.maven.org/maven2@id=central, https://repo.fusesource.com/nexus/content/groups/public@id=fusepublic, https://repository.jboss.org/nexus/content/repositories/public@id=jbosspublic, https://repo.fusesource.com/nexus/content/repositories/releases@id=jbossreleases, https://repo.fusesource.com/nexus/content/groups/ea@id=jbossearlyaccess, http://repository.springsource.com/maven/bundles/release@id=ebrreleases, http://repository.springsource.com/maven/bundles/external@id=ebrexternal
    Note
    The io.fabric8.agent PID is refined in all of the fabric profiles. Setting the proxy URL, the org.ops4j.pax.url.mvn.repositories property, in the default profile ensures that all of the other fabric profiles share the same Maven proxy setting.
    Important
    The fabric profile's io.fabric8.maven PID, which ultimately controls the Maven proxy, imports its value from the default profile's io.fabric8.agent PID. You should not change the settings of the io.fabric8.maven PID.
    Alternatively, instead of resetting the entire list of repositories, you can append a new entry to the repository list by invoking fabric:profile-edit with the --append option, as follows:
    JBossFuse:karaf@root> profile-edit --pid io.fabric8.agent/org.ops4j.pax.url.mvn.repositories='http://fusewin.tpb.lab.eng.brq.redhat.com:8081/nexus/content/repositories/fuse-qe-repo@id=fuse-qa' --append default 1.1
  3. Roll the changes out the fabric by upgrading the containers to the new profile version.
    Important
    You cannot test this configuration change out on a few containers to validate it. The change must be made to the entire fabric or it will result in conflicts.

Using an HTTP proxy with the Maven proxy

Using fabric's built-in Maven proxy, all nodes communicate directly with each other over HTTP. If you need to secure this communication (as when fabric's maven proxy must request maven artifacts from remote repositories), you can configure an HTTP proxy in fabric using a Maven settings.xml file that includes an HTTP proxy configuration.
To do so, follow these steps:
  1. Prepare an HTTP proxy settings file (see Example 12.2, “Example HTTP proxy settings .xml file” for example content), and put it in the Red Hat JBoss Fuse InstallDir/fuse/ directory.
  2. Start up JBoss Fuse, and create a fabric. For details, see the section called “Steps to create the fabric”.
  3. Specify the name and location of the HTTP settings file. At the JBossFuse:karaf@root> command line, type:
    profile-edit --pid io.fabric8.maven/io.fabric8.maven.settings=/home/fuse/http-proxy-settings.xml default
  4. Remove the org.ops4j.pax,url.mvn.repositories property from the default profile. At the JBossFuse:karaf@root> command line, type:
    profile-edit --delete --pid io.fabric8.agent/org.ops4j.pax.url.mvn.repositories default
    Removing this property causes the Maven proxy to pick up repositories from Maven's /home/.m2/settings.xml file, pointed to in the /home/fuse/http-proxy-settings.xml file.
    All fabric Maven proxy requests for remote repositories will now be redirected to the HTTP proxy server.

Example 12.2. Example HTTP proxy settings .xml file

<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
    http://maven.apache.org/xsd/settings-1.0.0.xsd">
    
  <!-- localRepository contains the path to the local repository maven  
       will use to store artifacts. Default: ~/.m2/repository -->
        
  <localRepository>/home/fuse/.m2/repository</localRepository>

      <proxies>
          <proxy>
              <id>qeos-proxy-1</id>
                  <active>true</active>
                  <protocol>http</protocol>
                  <host>10.8.50.13</host>
                  <port>3128</port>
          </proxy>
      </proxies>
      <profiles>
          <profile>
              <id>fuse-repo</id>
                  <repositories>
                      <repository>
                          <id>fuse-qe-repo</id>
                          <url>http://fusewin.tpb.lab.eng.brq.redhat.com:8081/nexus/content/repositories/fuse-qe-repo</url>
                              <layout>default</layout>
                      </repository>
                      <repository>
                          <id>central</id>
                          <url>http://repo1.maven.org/maven2@id=maven.central.repo</url>
                              <layout>default</layout>
                      </repository>
                  </repositories>
          </profile>
      </profiles>
      <activeProfiles>
          <activeProfile>fuse-repos</activeProfile>
      </activeProfiles>

</settings>
Red Hat logoGithubRedditYoutubeTwitter

Learn

Try, buy, & sell

Communities

About Red Hat Documentation

We help Red Hat users innovate and achieve their goals with our products and services with content they can trust.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

© 2024 Red Hat, Inc.