With IBM Business Automation Manager Open Editions version 9.2.1 aligning with BAMOE version 8.0 in the downstream build model, the artifacts are no longer available in Maven Central.

Instead the Maven libraries are shipped in the Maven repository format as a .zip file or via HTTP through a Container image you can deploy to your infrastructure.

If you have a Maven Repository Manager such as Artifactory or Nexus, you can import the compressed BAMOE Maven repository content into Maven Repository Manager.

For organizations without such infrastructure, it is highly recommended to use the Container image and make it available internally for developers and continuous integration (CI) systems.

For organizations that already use a Maven Repository Manager, developers and the CI systems are usually configured to connect to it.

If you are using the Container image, ensure that it is made available and provide the URL that developers and CI systems need to specify in their settings.xml file.

Note
When you configure the repository by modifying the Maven settings.xml file, the changes apply to all of your Maven projects.

There are two ways to do this:

  • Set up a Maven repository with a Container image

  • Configure your local Maven repository

Configuring Maven with the container image

Before changing your Maven settings you must first deploy/run the container image somewhere. There are a few options and your choice will depend on your work environment and the tools that are available to you.

Deploying to OpenShift

Choose the container image from one of the following sources:

bamoe-9.2.1-maven-repository-image.tar.gz

included in the distribution

quay.io/bamoe/maven-repository:9.2.1-ibm-0005

the image hosted on Quay.io

Caution

The container images provided are created for Linux distribution, running on a different architecture beside Linux x86_64 architecture may display a warning similar to: "WARNING: The requested image’s platform (linux/amd64) does not match the detected host platform (…​) and no specific platform was requested" which can be ignored.

Using bamoe-9.2.1-maven-repository-image.tar.gz

Enable the OpenShift registry and log into it using Docker:

oc patch configs.imageregistry.operator.openshift.io/cluster --patch '{"spec":{"defaultRoute":true}}' --type=merge
export REGISTRY=`oc get route default-route -n openshift-image-registry --template='{{ .spec.host }}'`
docker login -u `oc whoami` -p `oc whoami --show-token` ${REGISTRY}

Import the image from the tar.gz file, re-tag it, and push it to the OpenShift registry, replacing <PROJECT_NAME> with your OpenShift Project (namespace):

docker image load --input bamoe-{VERSION}-maven-repository-image.tar.gz
docker tag quay.io/bamoe/maven-repository:{IMAGE_VERSION} ${REGISTRY}/<PROJECT_NAME>/maven-repository:{IMAGE_VERSION}
docker push ${REGISTRY}/<PROJECT_NAME>/maven-repository:{IMAGE_VERSION}

Set an environment variable with the image name

export BAMOE_MAVEN_REPOSITORY_IMAGE=maven-repository:9.2.1-ibm-0005

Using quay.io/bamoe/maven-repository:9.2.1-ibm-0005

This case is simpler as you only need to set an environment variable with the image URL

export BAMOE_MAVEN_REPOSITORY_IMAGE=quay.io/bamoe/maven-repository:9.2.1-ibm-0005

Create the Deployment and Route

oc new-app ${BAMOE_MAVEN_REPOSITORY_IMAGE} --name bamoe-maven-repo
oc create route edge --service=bamoe-maven-repo

Get the Maven repository URL to be used in the next steps:

oc get route bamoe-maven-repo --output jsonpath={.spec.host}

Deploying to a Kubernetes cluster

Choose the container image from one of the following sources:

bamoe-9.2.1-maven-repository-image.tar.gz

included in the distribution

quay.io/bamoe/maven-repository:9.2.1-ibm-0005

the image hosted on Quay.io

Using the tar.gz included in the distribution

This step varies depending on your cluster configuration, but it may involve setting up an image registry (or using one that is already set up), loading and re-tagging the docker image, and pushing it to the registry with the new tag.

docker image load --input bamoe-9.2.1-maven-repository-image.tar.gz
docker tag quay.io/bamoe/maven-repository:9.2.1-ibm-0005 <REGISTRY_URL>/<NAMESPACE>/maven-repository:9.2.1-ibm-0005
docker push <REGISTRY_URL>/<NAMESPACE>/maven-repository:9.2.1-ibm-0005
Note
If you are using a local Kubernetes cluster with Minikube or Kind you can skip the re-tagging and pushing and follow these commands: for Minikube, run minikube image load quay.io/bamoe/maven-repository:9.2.1-ibm-0005; for Kind, run kind load docker-image quay.io/bamoe/maven-repository:9.2.1-ibm-0005.

Set an env var with the image name, For Kind and Minikube use the original quay.io URL for this variable:

export BAMOE_MAVEN_REPOSITORY_IMAGE=maven-repository:9.2.1-ibm-0005

Using Quay.io hosted version

In this case, all you need to do is set an env var with the image URL

export BAMOE_MAVEN_REPOSITORY_IMAGE=quay.io/bamoe/maven-repository:9.2.1-ibm-0005

Create the Deployment and Ingress, replacing <EXTERNAL_BAMOE_MAVEN_REPO_URL> with the URL that is mapped to your cluster:

kubectl create deployment bamoe-maven-repo --image=${BAMOE_MAVEN_REPOSITORY_IMAGE}
kubectl expose deployment bamoe-maven-repo --port=80 --target-port=8080
kubectl create ingress bamoe-maven-repo --rule="<EXTERNAL_BAMOE_MAVEN_REPO_URL>/*=bamoe-maven-repo:80"

For Kind or Minikube you could use something like bamoe-maven-repo.localhost, and then map this hostname to the cluster IP on your /etc/hosts file.

Running on Docker locally

Start by loading the tar.gz file or pulling the image from Quay.io:

  • bamoe-9.2.1-maven-repository-image.tar.gz

    docker image load --input bamoe-9.2.1-maven-repository-image.tar.gz
  • quay.io/bamoe/maven-repository:9.2.1-ibm-0005

    docker pull quay.io/bamoe/maven-repository:9.2.1-ibm-0005

Run the image mapping its <PORT> to the port that you want the container to be mapped to on your host.

docker run -d -p <PORT>:8080 quay.io/bamoe/maven-repository:9.2.1-ibm-0005

You can verify the repository is running by accessing the repository in your browser at http://localhost:<PORT>/com/ibm/bamoe.

Configure Maven with the container image URL

To configure Maven with a container image follow these steps:

  1. Download the dedicated M2 repository image container (bamoe-9.2.1-maven-repository-image.tar.gz).

  2. Open the Maven ~/.m2/settings.xml file in a text editor or IDE.

    Note
    If there is no settings.xml file in the ~/.m2/ directory, copy the settings.xml file from the $MAVEN_HOME/.m2/conf/ directory into the ~/.m2/ directory.
  3. Add the following lines to the <profiles> element of the settings.xml file:

    <profile>
      <id>ibm-bamoe-enterprise-maven-repository</id>
      <repositories>
        <repository>
          <id>ibm-bamoe-enterprise-maven-repository</id>
          <url>https://container-URL-here</url>
          <releases>
            <enabled>true</enabled>
          </releases>
          <snapshots>
            <enabled>false</enabled>
          </snapshots>
        </repository>
      </repositories>
      <pluginRepositories>
        <pluginRepository>
          <id>ibm-bamoe-enterprise-maven-repository</id>
          <url>https://container-URL-here/</url>
          <releases>
            <enabled>true</enabled>
          </releases>
          <snapshots>
            <enabled>false</enabled>
          </snapshots>
        </pluginRepository>
      </pluginRepositories>
    </profile>
  4. Add the following lines to the <activeProfiles> element of the settings.xml file and save the file:

    <activeProfile>ibm-bamoe-enterprise-maven-repository</activeProfile>

Configuring a local Maven repository for BAMOE

If you prefer not to use containers, you can download and configure the BAMOE Maven repository from the compressed file. The BAMOE Maven repository contains the libraries that Java developers need to build Business Services projects.

To configure the BAMOE Maven repository locally follow these steps:

  1. Download the Maven Repository bamoe-9.2.1-maven-repository.zip.

  2. Extract the downloaded archive.

  3. Go to the ~/.m2/ directory and open the Maven settings.xml file in a text editor or IDE.

  4. Add the following lines to the <profiles> element of the Maven settings.xml file, where <MAVEN_REPOSITORY> is the path of the Maven repository that you downloaded. The format of <MAVEN_REPOSITORY> must be file://$PATH. For example, file:///home/userX/bamoe-{VERSION}-maven-repository/:

    <profile>
      <id>ibm-bamoe-enterprise-maven-repository</id>
      <repositories>
        <repository>
          <id>ibm-bamoe-enterprise-maven-repository</id>
          <url><MAVEN_REPOSITORY></url>
          <releases>
            <enabled>true</enabled>
          </releases>
          <snapshots>
            <enabled>false</enabled>
          </snapshots>
        </repository>
      </repositories>
      <pluginRepositories>
        <pluginRepository>
          <id>ibm-bamoe-enterprise-maven-repository</id>
          <url><MAVEN_REPOSITORY></url>
          <releases>
            <enabled>true</enabled>
          </releases>
          <snapshots>
            <enabled>false</enabled>
          </snapshots>
        </pluginRepository>
      </pluginRepositories>
    </profile>
  5. Add the following lines to the <activeProfiles> element of the Maven settings.xml file and save the file:

<activeProfile>ibm-bamoe-enterprise-maven-repository</activeProfile>

If your Maven repository contains outdated artifacts, you might encounter Maven error messages when you build or deploy the project, such as:

  • Missing artifact <PROJECT_NAME>

  • [ERROR] Failed to execute goal on project <ARTIFACT_NAME>; Could not resolve dependencies for <PROJECT_NAME>

To resolve these issues, delete the cached version of your local repository that is located in the ~/.m2/repository directory to force a download of the latest Maven artifacts.

Your Maven repository is now properly configured and ready to build Business Service projects using a standard Maven workflow.