Camel K With local Maven Repository

484 Views Asked by At

I am looking to setup the settings for using my settings.xml. from the documentation I have done the following steps:

  1. kubectl create configmap maven-settings --from-file=settings.xml
  2. I have verified that this is in the dashboard.

My issue then becomes when I use Modeline or -d mvn:package:name:ver it can't find the JAR and from the logging of the camel-k-operator I am not seeing anything obvious as to which repository it is using.

is there an additional setting I need to be using to get it to use the maven-settings attribute when doing the following command:

  1. kamel run -d mvn:org.project:fakeProject:1.0.0 TestFile.java --dev

the above just gets into an infinite loop of retrying to build/deploy.

2

There are 2 best solutions below

0
VANAN On

You also need to configure Camel-K to use the configmap created (I don't see it in your steps).

After creating the config map, you either need to specify the name of the configmap when using kamel install:

kamel install --maven-settings=configmap:<configmap name>/<key in the configmap with settings>

for example:
kamel install --maven-settings=configmap:maven-settings/settings.xml

Or if you have Camel-K already installed, you need to reference the configmap in the IntegrationPlatform object (path: .spec.build.maven.settings.configMapKeyRef). This integration platform object is created when there is no other integration platform in the namespace when you run the first integration, so if it doesn't exist in your namespace, you can create it and camel-k operator will pick it up, for example:

apiVersion: camel.apache.org/v1
kind: IntegrationPlatform
metadata:
  labels:
    app: camel-k
  name: camel-k
spec:
  build:
    maven:
      settings:
        configMapKeyRef:
          key: settings.xml (key in your config map)
          name: maven-settings (name of your config map)
0
Squake On

A simple way to configure a maven repository is to do it when installing the Camel K operator, ie:

kamel install --maven-repository http://my-repo

Please, have a look at the kamel install --help options to see how to better configure it. The full list of possibilities is available in the official doc at https://camel.apache.org/camel-k/next/configuration/maven.html