Include Java Language Support in Camel K stack
Is your enhancement related to a problem? Please describe
it is possible to use standalone Java files for Camel K. having the Java Language Server will allow to have a good Java Language support for standalone Java files for Camel K.
Describe the solution you'd like
- include Java language support 0.55+ in Camel K stack
Describe alternatives you've considered
Additional context
- version 0.55.1 is required (and now available https://github.com/eclipse/che-plugin-registry/pull/376)
- memory needs to be looked at to have it working on che.openshift.io
- VS Code Java extension needs to access files downloaded in VS Code Camel K global storage filesystem
- at activation VS Code Camel K is downloading some dependencies, it will be nice to have them already downloaded in the image
VS Code Java extension needs to access files downloaded in VS Code Camel K global storage filesystem
seems there is no clean solution available currently to handle that.
- modify Java AND Camel K
meta.yamlfile to mount/home/theia/.theia/globalStorage/redhat.vscode-camelk/- it implies some Camel K code in Java plugin...
- we might go for mounting
/home/theia/.theia/globalStorage/and consider that it is generic to all possible VS Code extension integrations? - the content will be cleared on each restart of the workspace :-(
- include Java in Camel K base image (which is already based on Kubernetes one)
- we are loosing all composability and isolation
- another one???
second issue: seems the jar dependencies are not downloaded. it is creating the subfolder /home/theia/.theia/globalStorage/redhat.vscode-camelk/ava-dependencies-3.0.0 but it stays empty (seen no error so far, to be investigated)
I tried to use volumes on both plugins (java and Camel K), the mounted folder is empty in Java container. To try this case:
metadata:
name: apache-camel-k-secondtry
projects:
- name: camel-k-examples
source:
location: 'https://github.com/apache/camel-k'
type: git
sparseCheckoutDir: examples
components:
- id: redhat/vscode-xml/latest
memoryLimit: 150Mi
type: chePlugin
- id: redhat/vscode-apache-camel/latest
type: chePlugin
- type: chePlugin
reference: >-
https://raw.githubusercontent.com/apupier/che-plugin-registry/16018-shareVSCodeGlobalStorage/v3/plugins/redhat/vscode-camelk/0.0.12/meta.yaml
alias: vscode-camelk
- type: chePlugin
reference: >-
https://raw.githubusercontent.com/apupier/che-plugin-registry/16018-shareVSCodeGlobalStorage/v3/plugins/redhat/java/0.55.1/meta.yaml
apiVersion: 1.0.0
depends on https://github.com/eclipse/che/issues/13318
Given that volumes can now be shared ta plugin levels. This shouldn't be blocked anymore. Tried with newer Che. Updated branch for newer available Java and Camel K plugins.
current state:
- shared volumes seems to work fine (tried to create manually a file in one container, it is visible in the other one
- the setting provided by VS Code Camel K is wrong, it contains 2 times the /home/theia and i was also expecting it in globalstorage:
{
"java.project.referencedLibraries": [
"lib/**/*.jar",
"/home/theia/home/theia/redhat.vscode-camelk/java-dependencies-3.0.1/*.jar"
]
}
- the VS Code Camel K extension is not able to download the dependencies: *
ERROR:Remote plugin in vscode-camelkmtj: promise rejection is not handled in two seconds: Error: spawn mvn ENOENT
ERROR:Remote plugin in vscode-camelkmtj: promise rejection stack trace: Error: spawn mvn ENOENT
at Process.ChildProcess._handle.onexit (internal/child_process.js:240:19)
at onErrorNT (internal/child_process.js:415:16)
at process._tickCallback (internal/process/next_tick.js:63:19)
- ~~as it is supposed to rely on Maven wrapper, i don't understand why mvn cannot be found.~~ mvn is required
- maybe not worthy to investigate too much and provide the mvn binary in the sidecar, it will be faster
- mounting the .m2 migth be a good idea too
- providing the defautl jar binaries in sidecar image will allow faster first time completion access.
sharing global storage (which is is at a strange /home/theia/home/theia place) in both extensions and providing Maven and Java in VS Code Camel K container does most of the trick:

to test, devfile:
metadata:
name: apache-camel-k-with-sharedvolumes
projects:
- name: camel-k-examples
source:
location: 'https://github.com/apache/camel-k'
type: git
sparseCheckoutDir: examples
components:
- id: redhat/vscode-xml/latest
memoryLimit: 150Mi
type: chePlugin
- id: redhat/vscode-apache-camel/latest
type: chePlugin
- type: chePlugin
reference: >-
https://raw.githubusercontent.com/apupier/che-plugin-registry/16018-shareVSCodeGlobalStorage-withmavensidecar/v3/plugins/redhat/vscode-camelk/0.0.13/meta.yaml
alias: vscode-camelk
- type: chePlugin
reference: >-
https://raw.githubusercontent.com/apupier/che-plugin-registry/16018-shareVSCodeGlobalStorage-withmavensidecar/v3/plugins/redhat/java/0.57.0/meta.yaml
apiVersion: 1.0.0
content of the pointed branches:
apiVersion: v2
publisher: redhat
name: vscode-camelk
version: 0.0.13
type: VS Code extension
displayName: Tooling for Apache Camel K
title: Tooling for Apache Camel K
description: Support for Apache Camel K functionality
icon: https://www.eclipse.org/che/images/logo-eclipseche.svg
repository: https://github.com/camel-tooling/vscode-camelk
category: Language
firstPublicationDate: '2020-03-24'
spec:
containers:
- image: "apupier/che-sidecar-camelk:0.0.13-withmaven"
name: vscode-camelk
memoryLimit: "1G"
volumes:
- mountPath: "/home/theia/home/theia"
name: vscodeglobalstorage
extensions:
- https://download.jboss.org/jbosstools/vscode/stable/vscode-camelk/vscode-camelk-0.0.13-403.vsix
- https://download.jboss.org/jbosstools/vscode/3rdparty/vscode-kubernetes-tools/vscode-kubernetes-tools-1.1.0.vsix
- https://github.com/redhat-developer/vscode-yaml/releases/download/0.7.2/redhat.vscode-yaml-0.7.2.vsix
apiVersion: v2
publisher: redhat
name: java
version: 0.57.0
type: VS Code extension
displayName: Language Support for Java 8
title: Language Support for Java(TM) by Red Hat
description: Java Linting, Intellisense, formatting, refactoring, Maven/Gradle support and more...
icon: https://www.eclipse.org/che/images/logo-eclipseche.svg
repository: https://github.com/redhat-developer/vscode-java
category: Language
firstPublicationDate: "2020-02-20"
spec:
containers:
- image: "quay.io/eclipse/che-sidecar-java:8-0cfbacb"
name: vscode-java
memoryLimit: "1500Mi"
volumes:
- mountPath: "/home/theia/.m2"
name: m2
- mountPath: "/home/theia/home/theia"
name: vscodeglobalstorage
extensions:
- https://download.jboss.org/jbosstools/vscode/3rdparty/vscode-java-debug/vscode-java-debug-0.24.0.vsix
- https://download.jboss.org/jbosstools/static/jdt.ls/stable/java-0.57.0-2029.vsix
content of the DockerFile for the sidecar:
FROM quay.io/eclipse/che-sidecar-kubernetes-tooling:1.1.0-24dc4a3
ENV MAVEN_VERSION 3.6.3
RUN mkdir -p /usr/share/maven /usr/share/maven/ref \
&& curl -fsSL -o /tmp/apache-maven.tar.gz https://apache.osuosl.org/maven/maven-3/${MAVEN_VERSION}/binaries/apache-maven-${MAVEN_VERSION}-bin.tar.gz \
&& tar -xzf /tmp/apache-maven.tar.gz -C /usr/share/maven --strip-components=1 \
&& rm -f /tmp/apache-maven.tar.gz \
&& ln -s /usr/share/maven/bin/mvn /usr/bin/mvn
ENV MAVEN_HOME /usr/share/maven
RUN dnf -y update && \
dnf -y install java-11-openjdk && \
dnf clean all;
ENV KAMEL_VERSION 1.0.0-RC2
RUN curl -L https://github.com/apache/camel-k/releases/download/${KAMEL_VERSION}/camel-k-client-${KAMEL_VERSION}-linux-64bit.tar.gz | tar -C /usr/local/bin -xz \
&& chmod +x /usr/local/bin/kamel
identified issues/improvements/questions:
- is it fine to share the global storage in VS Code Java extension? (I think yes but need to be accepted by VS Code Java plugin maintainers)
- should we change the global storage place to have a more meaningful name than
/home/theia/home/theia? - several Java errors reported on some examples provided by default:
- several examples now requires additional dependencies, which needs ot be handled manually currently... so either need to implement https://github.com/camel-tooling/vscode-camelk/issues/337 or to provide other examples
- VS Code Java doesn't support subfolders (or support it by considering them as packages, depending on the expected behavior): either use another set of examples that are not inside subfolders or change behavior of VS Code Java and doesn't handle folders as "java package" for standalone Java files/simple projects
- another set of examples is available here https://github.com/apache/camel-k-examples/tree/master/01-basic but it will require to have VS Code Didact otherwise the readme will display badly
- providing the defautl jar binaries in sidecar image will allow faster first time completion access.
- is there easier way to have mvn and Java in the DockerFile?
maybe worth another try activating the "async storage" fetaure https://github.com/eclipse/che/pull/16972
Issues go stale after 180 days of inactivity. lifecycle/stale issues rot after an additional 7 days of inactivity and eventually close.
Mark the issue as fresh with /remove-lifecycle stale in a new comment.
If this issue is safe to close now please do so.
Moderators: Add lifecycle/frozen label to avoid stale mode.
/remove-lifecycle stale
Issues go stale after 180 days of inactivity. lifecycle/stale issues rot after an additional 7 days of inactivity and eventually close.
Mark the issue as fresh with /remove-lifecycle stale in a new comment.
If this issue is safe to close now please do so.
Moderators: Add lifecycle/frozen label to avoid stale mode.
/remove-lifecycle stale
Issues go stale after 180 days of inactivity. lifecycle/stale issues rot after an additional 7 days of inactivity and eventually close.
Mark the issue as fresh with /remove-lifecycle stale in a new comment.
If this issue is safe to close now please do so.
Moderators: Add lifecycle/frozen label to avoid stale mode.
/remove-lifecycle stale
Issues go stale after 180 days of inactivity. lifecycle/stale issues rot after an additional 7 days of inactivity and eventually close.
Mark the issue as fresh with /remove-lifecycle stale in a new comment.
If this issue is safe to close now please do so.
Moderators: Add lifecycle/frozen label to avoid stale mode.
/remove-lifecycle stale
Issues go stale after 180 days of inactivity. lifecycle/stale issues rot after an additional 7 days of inactivity and eventually close.
Mark the issue as fresh with /remove-lifecycle stale in a new comment.
If this issue is safe to close now please do so.
Moderators: Add lifecycle/frozen label to avoid stale mode.
Issues go stale after 180 days of inactivity. lifecycle/stale issues rot after an additional 7 days of inactivity and eventually close.
Mark the issue as fresh with /remove-lifecycle stale in a new comment.
If this issue is safe to close now please do so.
Moderators: Add lifecycle/frozen label to avoid stale mode.
Issues go stale after 180 days of inactivity. lifecycle/stale issues rot after an additional 7 days of inactivity and eventually close.
Mark the issue as fresh with /remove-lifecycle stale in a new comment.
If this issue is safe to close now please do so.
Moderators: Add lifecycle/frozen label to avoid stale mode.