Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid overwriting JAVA_HOME by IDEA #969

Open
wants to merge 1 commit into
base: devspaces-3-rhel-8
Choose a base branch
from

Conversation

azatsarynnyy
Copy link
Member

What does this PR do?

In the UDI image, /home/user/.java is a JAVA_HOME.
IDEA editor is overwriting that directory by its config.
This patch changes the IDEA config path.

What issues does this PR fix or reference?

https://issues.redhat.com/browse/CRW-4525

Release Notes

Docs PR (if applicable)

@l0rd
Copy link
Contributor

l0rd commented Jun 15, 2023

@azatsarynnyy shouldn't you update JetBrains IDEs config to reflect that now projector Java configuration is in ${HOME}/.projector-java?

@azatsarynnyy
Copy link
Member Author

@azatsarynnyy shouldn't you update JetBrains IDEs config to reflect that now projector Java configuration is in ${HOME}/.projector-java?

@l0rd Sorry, I didn't get your idea about updating the JetBrains IDEs config. Do you mean this environment variable?

- name: PROJECTOR_CONFIG_DIR
  value: /home/user/.jetbrains

Why do you think we need to change it?

@l0rd
Copy link
Contributor

l0rd commented Jun 15, 2023

What I mean is that projector is currently using the folder ~/.java to store its configuration. The fact that you have changed the folder of the volume doesn't affect projector configuration: the folder ~/.projector-java will be persisted but I suspect that projector will continue to write its configuration in ~/.java.

@azatsarynnyy
Copy link
Member Author

Yes, we need to tell our Jetbrains editors to use another folder.
I checked why do we need a volume for it:
JetBrains IDEs store some values to java preferences. Like accepted EULA.
On Linux, Java Preferences API storage is in the $HOME/.java/.userPrefs/prefs.xml directory, by default.
Having a volume for /home/user/.java allows restoring such java preferences for IDEA across workspace restarts.

The only idea I have for now is passing something like -Djava.util.prefs.systemRoot=/home/user/.projector-java when running IDE. But it seems too fragile for me.

@l0rd
Copy link
Contributor

l0rd commented Jun 15, 2023

The only idea I have for now is passing something like -Djava.util.prefs.systemRoot=/home/user/.projector-java when running IDE. But it seems too fragile for me.

Why do you think it's fragile? What could go wrong?

Also another alternative is to copy $HOME/.java/.userPrefs/prefs.xml to $HOME/.jetbrains at container startup and restore it at startup...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants