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

IDEasy can not handle a faulty definition of JAVA_HOME #925

Open
jan-vcapgemini opened this issue Jan 13, 2025 · 1 comment
Open

IDEasy can not handle a faulty definition of JAVA_HOME #925

jan-vcapgemini opened this issue Jan 13, 2025 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@jan-vcapgemini
Copy link
Contributor

jan-vcapgemini commented Jan 13, 2025

Expected behavior

As an IDEasy user I expect IDEasy to help me fix issues with my Java configuration.

Actual behavior

If I deliberately use a faulty Java configuration e.g. set my JAVA_HOME to a non existent directory, IDEasy will just report an error like this:

$ ide mvn
The JAVA_HOME environment variable is not defined correctly,
this environment variable is needed to run this program.
Running command 'D:\Projects\ideasy-dev\software\mvn\bin\mvn.cmd'
failed with exit code 1!
Step 'ide (mvn)' failed: com.devonfw.tools.ide.cli.CliProcessException: Running command 'D:\Projects\ideasy-dev\software\mvn\bin\mvn.cmd'
failed with exit code 1!
1 step(s) failed out of 3 steps.
Running command 'D:\Projects\ideasy-dev\software\mvn\bin\mvn.cmd'
failed with exit code 1!

Error: IDEasy failed with exit code 1

Instead if would be better if IDEasy can repair itself or point the user in the right direction to fix this problem.

Steps to reproduce (bug) / Use Case of feature request (enhancement)

  1. Open a mvn project within an IDEasy project e.g. switch the directory to projects/IDEasy/workspaces/main/IDEasy
  2. Type: export JAVA_HOME="C:/Test"
  3. Try to run ide mvn

Related/Dependent Issues

Comments/Hints:

It would for example be helpful, if IDEasy would print out where the JAVA_HOME variable is pointing to.

Affected version:

  • OS: Windows
  • IDEasy: 2024.12.001-beta
@jan-vcapgemini jan-vcapgemini added the bug Something isn't working label Jan 13, 2025
@github-project-automation github-project-automation bot moved this to 🆕 New in IDEasy board Jan 13, 2025
@jan-vcapgemini jan-vcapgemini moved this from 🆕 New to Refinement in IDEasy board Jan 14, 2025
@hohwille
Copy link
Member

First of all I think that it is not IDEasy but maven that cannot handle a faulty definition of JAVA_HOME.
What we could do in IDEasy is to expose our environment variables from ToolCommandlet.setEnvironment also to the shell.
That means the following:

  • We will improve EnvironmentCommandlet
  • It will iterate all LocalToolCommandlets for installed tools (see UpdateCommandlet.updateSoftware() to get the idea)
  • For each ToolCommandlet we will call setEnvironment and pass the same instance of EnvironmentContext that collects the environment variables to a Map<String, String> (or Properties).
  • At the end of the loop, we add all these collected variables that are not already defined to the output.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Refinement
Development

No branches or pull requests

2 participants