Camel K standalone Java file: Now with Java language support
Apache Camel K should be as lightweight as possible. Therefore, the Camel K project provides standalone Java files to describe a Camel integration. The downside to this practice is that existing IDEs cannot provide complete support out of the box. To provide a complete experience with Apache Camel K’s standalone Java files, there were three solutions:
- Create a fake project with Camel dependencies.
- Add all jar dependencies manually in a lib folder at the root of the workspace.
- Use the newest
java.project.referencedLibrariespreference from Red Hat’s Language Support for Java extension.
As a result, there is no intuitive configuration. However, Red Hat’s Tooling for Apache Camel K offers a new possibility.
With Tooling for Apache Camel K version 0.11.0, Java language support is now included, and there are only two requirements. First, you need to have the word “camel” in the Java file’s content. Most of the time, this requirement is satisfied by the import package, itself. Second, you must have no project in the workspace. If there are projects, we expect that the classic Maven/Gradle build provides the Java language support. However, these requirements should not be a problem in most cases.
Here is the completion process on an Apache Camel K standalone Java file:
Next, you might try to transpose the tutorial Sending a telegram with Apache Camel K and Visual Studio Code using Java.