-
Notifications
You must be signed in to change notification settings - Fork 77
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
Low transparency failure to resolve libraries #1905
Comments
That's a very nasty bug. I remember that at the beginning of my thesis, I tried multiple times to get my dependencies for my project imported, but I always got the import warning. Eventually, I got it to work and thought, I must have missed a few steps when creating the builds for the libraries. (╯°□°)╯︵ ┻━┻ |
For completness: The origin of all this mess from my side was a wrong version (did not exist) in the |
Yes, it's a bit sensitive right now. We've been trying to improve this part. I think the current idea of how to improve it is: #1886 |
Let's continue this here at #1916 ; the new |
When Rascal tries to resolve libraries, we can encounter something like
even though, Clair is installed on the system.
It turns out that this can happen when the project that is loaded into the REPL causes errors:
In order to resolve a library function, Rascal tries to look up the name in mavenLibs to resolve it (assuming that we have no project of that name loaded). This variable is filled from the content of mavenClasspath which in turn is a result of the method getPomXmlCompilerClasspath:
IList mavenClasspath = getPomXmlCompilerClasspath(manifestRoot);
When
mavenClasspath
is empty, libraries can not be resolved and the warning is printed.It turns out that one case where this happens, is when the project that we load into the REPL throws errors through Maven:
getPomXmlCompilerClasspath
executesmvn
commands and tries to parse the output. Because it does so very optimistic, errors in the execution of these commands get shadowed by the parser and just lead to an empty list that the method returns.In my project, I got the follow output that
getPomXmlCompilerClasspath
tried to parse using the commandmvn --batch-mode -o dependency:build-classpath -DincludeScope=compile
:Because the method only returns an empty list, this error is not reported to the user. As a consequence, they are unable to fix the project and get their project to run in the REPL, because of missing dependencies.
Proposed solution (other for other places where the output of another process is used): Make sure to check the exit code of the process (here,
Process process = processBuilder.start();
andprocess.exitcode
is indeed 1) and report the error of the underlying process to the user (or allow them to see what was executed to reproduce on their own).Another problem
The line
also can fail silently: If there is no manifest file (for reasons that I'm also trying to understand myself at the moment),
manifest.manifest(dep)
is simplynull
, solibProjectName
ultimately becomes the empty string and the mapping breaks as well.The text was updated successfully, but these errors were encountered: