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

Invoked maven should be executed in same java environment as rascal itself #1770

Closed
DavyLandman opened this issue Feb 10, 2023 · 3 comments · Fixed by #1771
Closed

Invoked maven should be executed in same java environment as rascal itself #1770

DavyLandman opened this issue Feb 10, 2023 · 3 comments · Fixed by #1771
Assignees
Labels

Comments

@DavyLandman
Copy link
Member

DavyLandman commented Feb 10, 2023

We call maven from within rascal, this assumes first that maven is installed, and that java is installed.

But if a user installed maven, and has a JAVA_HOME pointing to java 8, but starting rascal with a different JDK (either via java_home, or via path, an explicit path, or vscode auto install) the invoked mvn is running in a different version of java.

In some setups (like for example the vscode auto install) this can cause problems.

We should, when invoking mvn, copy our own java.home property onto the environement of the mvn call. Note #1661 also solves this issue, since it doesn't fork to maven anymore.

thanks @djswagerman for taking the time to test it out and report the issue.

@DavyLandman DavyLandman self-assigned this Feb 10, 2023
DavyLandman added a commit that referenced this issue Feb 10, 2023
Sometimes rascal is running inside of a jdk that is not the same as JAVA_HOME, or JAVA_HOME is note defined

Fixes #1770
@jurgenvinju
Copy link
Member

will mvn always use JAVA_HOME or will we use the mvn in the PATH with a given JAVA_HOME?

@jurgenvinju
Copy link
Member

is this the issue where clair would not work with a difference JRE?

@DavyLandman
Copy link
Member Author

DavyLandman commented Feb 10, 2023

will mvn always use JAVA_HOME or will we use the mvn in the PATH with a given JAVA_HOME?

  • when rascal starts mvn it should be on it's path (this is a limitation of the vscode auto installer of java, it's not bringing along a maven install), again Rework maven code for faster calculation of path config #1661 fixes that, and otherwise we would need to do some changes on how the maven executable is found.
  • maven's command line util says:
# -----------------------------------------------------------------------------
# Apache Maven Startup Script
#
# Environment Variable Prerequisites
#
#   JAVA_HOME       Must point at your Java Development Kit installation.

and looking at the code, java on your path is not enough, it should have a valid JAVA_HOME. This PR just makes sure that JAVA_HOME is correctly setup, and points to the same jdk as rascal is running under. Since rascal can be started by a JVM that is not defined in the JAVA_HOME env.

is this the issue where clair would not work with a difference JRE?

I don't know that specific issue. But I think @djswagerman could tell you if this was the same problem.

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

Successfully merging a pull request may close this issue.

2 participants