Apache Camel K should be as lightweight as possible. Therefore, the Camel K project provides standalone Java files that describe a Camel integration. The downside to this practice is that existing IDEs cannot provide complete support out of the box. A few months ago, I mentioned the Java language support for Apache Camel K that was discussed in Red Hat Visual Studio Code (VS Code) extension, and how it provides Java language support for Apache Camel K. In this article and demo, I show you how to do the same with Eclipse Che and che.openshift.io.
Demo: Using the Java language plug-in
I’ve written an example application to demonstrate how to use this plug-in to add Java language support to Apache Camel K within Eclipse Che. If you have an account on che.openshift.io, that interface offers a button you can click to open the example in a ready-to-use Che workspace. The included video shows how easy it is to start a workspace with a pre-configured devfile.
Fortunately, the Java language support extension is compatible with other Camel K on Che features. (Click the link for a detailed introduction to Apache Camel K development inside of Eclipse Che.)
Configuring Java support for your Apache Camel K projects
The key point is to reference the specific plug-in configuration that you need. In your devfile, you need to add a reference to the
chePlugin for Camel K:
- type: chePlugin reference: >- https://raw.githubusercontent.com/apupier/camelk-on-che-with-java-support-example/master/.che/camelk-plugin-meta.yaml alias: vscode-camelk
Apart from that, the Che devfile configuration is typical. See the Eclipse Che documentation for a discussion of various ways to take advantage of the Che devfile configuration possibilities.
The provided plug-in configuration groups together the VS Code extensions for Kubernetes, Camel K, and Java. We used a custom dockerfile as a sidecar to gather requirements for all of the extensions used in the Che plug-in definition.
These extensions are grouped because all of them rely on passing files through the filesystem (VS Code Global Storage), sharing
kubeconfig, and reusing command-line tooling (
kubectl, mvn). In the future, we expect that we won’t need a specific plug-in definition; we also expect to have a predefined stack configured.
We are working on including Java language support directly in the Apache Camel K stack. To help promote this initiative, please follow, vote, and help us with this issue.
The post Add Java language support for Apache Camel K inside Eclipse Che appeared first on Red Hat Developer.
Source: Red Hat