With IBM Business Automation Manager Open Editions v9.1 aligning with its previous version BAMOE v8 in the downstream build model, the artifacts are no longer available in Maven Central. The artifacts are shipped as part of the product as a Container Image and Maven Repository inside the compressed file in a consumable format.
If you have a Maven Repository Manager tool like Artifactory or Nexus, you can import the compressed BAMOE Maven repository content into Maven Repository Manager.
For companies without such infrastructure, it is highly recommended to use the container image and make it available within the company for all developers and the continuous integration (CI) system.
For companies that already use a Maven Repository Manager tool, developers and the CI system are typically configured to connect with it.
If you are using the container image, ensure that it is made available and provide the URL that developers and the CI system 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 between using the
-
bamoe-9.1.1-maven-repository-image.tar.gz
-
quay.io/bamoe/maven-repository:9.1.0-ibm-0001
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.1.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
docker image load --input bamoe-9.1.x-maven-repository-image.tar.gz
docker tag quay.io/bamoe/maven-repository:9.1.0-ibm-0001 ${REGISTRY}/<PROJECT_NAME>/maven-repository:9.1.0-ibm-0001
docker push ${REGISTRY}/<PROJECT_NAME>/maven-repository:9.1.0-ibm-0001
# Replace <PROJECT_NAME> with your OpenShift Project (namespace)
Set an environment variable with the image name
export BAMOE_MAVEN_REPOSITORY_IMAGE=maven-repository:9.1.0-ibm-0001
Using quay.io/bamoe/maven-repository:9.1.0-ibm-0001
In this case, not much needs to be done, just set an environment variable with the image URL
export BAMOE_MAVEN_REPOSITORY_IMAGE=quay.io/bamoe/maven-repository:9.1.0-ibm-0001
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 between using
-
bamoe-9.1.x-maven-repository-image.tar.gz
-
the hosted quay.io/bamoe/maven-repository:9.1.0-ibm-0001 image
Using bamoe-9.1.x-maven-repository-image.tar.gz
This step varies depending on your cluster configuration, but it may involve setting up (or using an already set up) image registry, loading and re-tagging the docker image, and then pushing it to the registry with the new tag.
docker image load --input bamoe-9.1.1-maven-repository-image.tar.gz
docker tag quay.io/bamoe/maven-repository:9.1.0-ibm-0001 <REGISTRY_URL>/<NAMESPACE>/maven-repository:9.1.0-ibm-0001
docker push <REGISTRY_URL>/<NAMESPACE>/maven-repository:9.1.0-ibm-0001
Note
|
If you’re 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.1.0-ibm-0001 ; for Kind, run kind load docker-image quay.io/bamoe/maven-repository:9.1.0-ibm-0001 .
|
Set an env var with the image name
export BAMOE_MAVEN_REPOSITORY_IMAGE=maven-repository:9.1.0-ibm-0001
# For Kind and Minikube use the original quay.io URL for this variable
Using quay.io/bamoe/maven-repository:9.1.0-ibm-0001
In this case, not much needs to be done, just set an env var with the image URL
export BAMOE_MAVEN_REPOSITORY_IMAGE=quay.io/bamoe/maven-repository:9.1.0-ibm-0001
Create the Deployment and Ingress
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"
# Replace <EXTERNAL_BAMOE_MAVEN_REPO_URL> with whatever URL is mapped to your cluster.
# 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.1.x-maven-repository-image.tar.gz
docker image load --input bamoe-9.1.x-maven-repository-image.tar.gz
-
quay.io/bamoe/maven-repository:9.1.0-ibm-0001
docker pull quay.io/bamoe/maven-repository:9.1.0-ibm-0001
Run the image mapping its port:
docker run -d -p <PORT>:8080 quay.io/bamoe/maven-repository:9.1.0-ibm-0001 # Replace <PORT> with whatever port you want the container to be mapped to on your host.
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:
-
Download the dedicated M2 repository image container (
bamoe-9.1.x-maven-repository-image.tar.gz
). -
Open the Maven
~/.m2/settings.xml
file in a text editor or integrated development environment (IDE).NoteIf there is no settings.xml
file in the~/.m2/
directory, copy thesettings.xml
file from the$MAVEN_HOME/.m2/conf/
directory into the~/.m2/
directory. -
Add the following lines to the
<profiles>
element of thesettings.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>
-
Add the following lines to the
<activeProfiles>
element of thesettings.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 BAMOE applications.
To configure the BAMOE Maven repository locally follow these steps:
-
Download the BAMOE v9.1.0 Maven Repository (
bamoe-9.1.x-maven-repository.zip
). -
Extract the downloaded archive.
-
Go to the
~/.m2/
directory and open the Mavensettings.xml
file in a text editor or IDE. -
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 befile://$PATH
. For example,file:///home/userX/bamoe-9.1.x-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>
-
Add the following lines to the
<activeProfiles>
element of the Mavensettings.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 BAMOE based projects using a standard Maven workflow.