You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Michael Rambichler <mi...@rambichler.at> on 2022/04/26 17:09:38 UTC

Camel-K and local maven repository

Hi Guys,

I just do not get it running to reference a local dependency in my camel-k
integrations.

Any help or hints would be appreciated.

Best
 Michael

Please see below my test setting.
This is my simple Test route with a modline: dependency=
*mvn:com.hello:hello-tool:1.0.0*

// camel-k: dependency=mvn:com.hello:hello-tool:1.0.0

import org.apache.camel.builder.RouteBuilder;

public class Testen extends RouteBuilder {

    @Override
    public void configure() throws Exception {

        // Write your routes here, for example:
        from("timer:java?period=10000")
                .routeId("java")
                .setBody()
                .simple("Hello Camel K from ${routeId}")
                .to("log:info");
    }
}

In my IntegrationPlatform i reference a configmap test-settings with the
key/file: settings.xml
spec:
  build:
    maven:
      settings:
        configMapKeyRef:
          key: settings.xml
          name: test-settings

test-settings configmap:
kind: ConfigMap
apiVersion: v1
metadata:
  name: test-settings
  namespace: ics-int-eai-dev
  uid: d2ec3f2f-5c7f-461b-94ce-8afadc3b68ac
  resourceVersion: '1082114576'
  creationTimestamp: '2022-04-26T15:56:48Z'
  managedFields:
    - manager: kubectl.exe
      operation: Update
      apiVersion: v1
      time: '2022-04-26T15:56:48Z'
      fieldsType: FieldsV1
      fieldsV1:
        'f:data': {}
    - manager: Mozilla
      operation: Update
      apiVersion: v1
      time: '2022-04-26T16:24:33Z'
      fieldsType: FieldsV1
      fieldsV1:
        'f:data':
          'f:settings.xml': {}
data:
  settings.xml: "<repositories>
            <repository>
              <url>http://localserver:8081/nexus/content/groups/public</url>
              <snapshots>
                <enabled>true</enabled>
                <checksumPolicy>fail</checksumPolicy>
              </snapshots>
              <releases>
                <enabled>false</enabled>
                <checksumPolicy>fail</checksumPolicy>
              </releases>
            </repository>"

Re: Camel-K and local maven repository

Posted by Pasquale Congiusti <pa...@gmail.com>.
On top of what John has suggested, also remind you can use the Jitpack
feature for any dependencies which can be stored in Git. See the
documentation [1] and an example [2] as a reference.

Cheers,
Pasquale.

[1]
https://camel.apache.org/camel-k/next/configuration/dependencies.html#dependencies-kind-jitpack
[2] https://github.com/apache/camel-k/tree/main/examples/jitpack

On Wed, Apr 27, 2022 at 10:56 AM John Poth <po...@gmail.com> wrote:

> Hi Michael,
>
> Is your Maven repository http://localserver:8081/ accessible from the
> camel-k operator pod ? Logs from the operator pod might help troubleshoot.
>
> Alternatively, as of camel-k v1.9.0, you can use local dependencies
> directly from the run command:
>
> kamel run integration.java -d file://hello-tool:1.0.0.jar
>
> Thanks !
>
> On Tue, Apr 26, 2022 at 7:10 PM Michael Rambichler <mi...@rambichler.at>
> wrote:
>
> > Hi Guys,
> >
> > I just do not get it running to reference a local dependency in my
> camel-k
> > integrations.
> >
> > Any help or hints would be appreciated.
> >
> > Best
> >  Michael
> >
> > Please see below my test setting.
> > This is my simple Test route with a modline: dependency=
> > *mvn:com.hello:hello-tool:1.0.0*
> >
> > // camel-k: dependency=mvn:com.hello:hello-tool:1.0.0
> >
> > import org.apache.camel.builder.RouteBuilder;
> >
> > public class Testen extends RouteBuilder {
> >
> >     @Override
> >     public void configure() throws Exception {
> >
> >         // Write your routes here, for example:
> >         from("timer:java?period=10000")
> >                 .routeId("java")
> >                 .setBody()
> >                 .simple("Hello Camel K from ${routeId}")
> >                 .to("log:info");
> >     }
> > }
> >
> > In my IntegrationPlatform i reference a configmap test-settings with the
> > key/file: settings.xml
> > spec:
> >   build:
> >     maven:
> >       settings:
> >         configMapKeyRef:
> >           key: settings.xml
> >           name: test-settings
> >
> > test-settings configmap:
> > kind: ConfigMap
> > apiVersion: v1
> > metadata:
> >   name: test-settings
> >   namespace: ics-int-eai-dev
> >   uid: d2ec3f2f-5c7f-461b-94ce-8afadc3b68ac
> >   resourceVersion: '1082114576'
> >   creationTimestamp: '2022-04-26T15:56:48Z'
> >   managedFields:
> >     - manager: kubectl.exe
> >       operation: Update
> >       apiVersion: v1
> >       time: '2022-04-26T15:56:48Z'
> >       fieldsType: FieldsV1
> >       fieldsV1:
> >         'f:data': {}
> >     - manager: Mozilla
> >       operation: Update
> >       apiVersion: v1
> >       time: '2022-04-26T16:24:33Z'
> >       fieldsType: FieldsV1
> >       fieldsV1:
> >         'f:data':
> >           'f:settings.xml': {}
> > data:
> >   settings.xml: "<repositories>
> >             <repository>
> >               <url>http://localserver:8081/nexus/content/groups/public
> > </url>
> >               <snapshots>
> >                 <enabled>true</enabled>
> >                 <checksumPolicy>fail</checksumPolicy>
> >               </snapshots>
> >               <releases>
> >                 <enabled>false</enabled>
> >                 <checksumPolicy>fail</checksumPolicy>
> >               </releases>
> >             </repository>"
> >
>

Re: Camel-K and local maven repository

Posted by John Poth <po...@gmail.com>.
Hi Michael,

Is your Maven repository http://localserver:8081/ accessible from the
camel-k operator pod ? Logs from the operator pod might help troubleshoot.

Alternatively, as of camel-k v1.9.0, you can use local dependencies
directly from the run command:

kamel run integration.java -d file://hello-tool:1.0.0.jar

Thanks !

On Tue, Apr 26, 2022 at 7:10 PM Michael Rambichler <mi...@rambichler.at>
wrote:

> Hi Guys,
>
> I just do not get it running to reference a local dependency in my camel-k
> integrations.
>
> Any help or hints would be appreciated.
>
> Best
>  Michael
>
> Please see below my test setting.
> This is my simple Test route with a modline: dependency=
> *mvn:com.hello:hello-tool:1.0.0*
>
> // camel-k: dependency=mvn:com.hello:hello-tool:1.0.0
>
> import org.apache.camel.builder.RouteBuilder;
>
> public class Testen extends RouteBuilder {
>
>     @Override
>     public void configure() throws Exception {
>
>         // Write your routes here, for example:
>         from("timer:java?period=10000")
>                 .routeId("java")
>                 .setBody()
>                 .simple("Hello Camel K from ${routeId}")
>                 .to("log:info");
>     }
> }
>
> In my IntegrationPlatform i reference a configmap test-settings with the
> key/file: settings.xml
> spec:
>   build:
>     maven:
>       settings:
>         configMapKeyRef:
>           key: settings.xml
>           name: test-settings
>
> test-settings configmap:
> kind: ConfigMap
> apiVersion: v1
> metadata:
>   name: test-settings
>   namespace: ics-int-eai-dev
>   uid: d2ec3f2f-5c7f-461b-94ce-8afadc3b68ac
>   resourceVersion: '1082114576'
>   creationTimestamp: '2022-04-26T15:56:48Z'
>   managedFields:
>     - manager: kubectl.exe
>       operation: Update
>       apiVersion: v1
>       time: '2022-04-26T15:56:48Z'
>       fieldsType: FieldsV1
>       fieldsV1:
>         'f:data': {}
>     - manager: Mozilla
>       operation: Update
>       apiVersion: v1
>       time: '2022-04-26T16:24:33Z'
>       fieldsType: FieldsV1
>       fieldsV1:
>         'f:data':
>           'f:settings.xml': {}
> data:
>   settings.xml: "<repositories>
>             <repository>
>               <url>http://localserver:8081/nexus/content/groups/public
> </url>
>               <snapshots>
>                 <enabled>true</enabled>
>                 <checksumPolicy>fail</checksumPolicy>
>               </snapshots>
>               <releases>
>                 <enabled>false</enabled>
>                 <checksumPolicy>fail</checksumPolicy>
>               </releases>
>             </repository>"
>