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

%classpath add mvn: NoSuchFileException #7780

Closed
duchenne opened this issue Sep 1, 2018 · 5 comments
Closed

%classpath add mvn: NoSuchFileException #7780

duchenne opened this issue Sep 1, 2018 · 5 comments
Assignees

Comments

@duchenne
Copy link

duchenne commented Sep 1, 2018

I don't seem to be able to use %classpath add mvn anymore since v1.1.0.

I'm working on Windows, with v1.1.0 of BeakerX installed with pip, and maven 3.5.4 in my PATH. I'm starting with an empty Clojure notebook and then I'm executing %classpath add mvn com.google.code.gson gson 2.2.4 (or any other library). This throws exception:

java.nio.file.NoSuchFileException: C:\Users\XXXX\AppData\Local\Temp\beaker400090105507806186\mvnJars\mavenclasspathfilename.txt

When I execute %classpath add mvn ..., the notebook shows that the library gets downloaded from the remote repo, but then NoSuchFileException is thrown. The library does appear in the local cache after this. But if I re-run %classpath add mvn ..., with the files already there, the download starts again, and the exception is thrown again.

So whether the library is already in the cache or not, I can't add any maven dependency to my classpath.

Reverting to 1.0.0 (simply pip install beakerx==1.0.0) solves the issue.

@jpallas
Copy link
Contributor

jpallas commented Sep 2, 2018

I suspect this is some kind of Maven/Windows issue possibly involving File.separator, but I don't have a Windows system to investigate.

@altavir
Copy link

altavir commented Sep 2, 2018

I confirm on windows 10. The text file indeed does not exist (the jar is where is should be). Also the path shown in the notebook uses DOS-like abbreviation for user name which is not used for a long time. Windows 10 fully supports unix-like paths.

@altavir
Copy link

altavir commented Sep 2, 2018

I've searched the source code. The path is resolved here. The code is really strange since it uses manual addition of token to path and transformation from io path to nio path.

it should be like this:

      File file= new File(pathToMavenRepo, MAVEN_BUILT_CLASSPATH_FILE_NAME);
      InputStream isPaths = new FileInputStream(file);

Also it is possible to avoid IOUtils and us lines method from NIO.
I think that actual problem is in pathToMavenRepo, but I can't investigate right now.
Guys, I do not want to insult anyone but whoever wrote the code does not seem to have actual java experience. Do you have someone on code review, who does? It will be terribly hard to clean up everything later.

@jpallas
Copy link
Contributor

jpallas commented Sep 3, 2018

Guys, I do not want to insult anyone but …

Let's focus on finding and fixing the bug in this discussion. Every software project that isn't a solo effort will have a variety of contributors with a variety of backgrounds, and every open source software project can benefit from volunteers helping to improve the code.

@altavir
Copy link

altavir commented Sep 3, 2018

Sorry. My rude remarks aside, the problem probably comes from python part. I've encountered similar behavior in another python based piece of code recently. For some reason it tries to use DOS-like name abbreviations for user home directory name.

LeeTZ pushed a commit that referenced this issue Sep 20, 2018
)

* #7780: fix %classpath add mvn: NoSuchFileException

* #7780: fix ClasspathAddMvnDepsMagicCommandTest under windows

* #7780: removing File.separator

* #7797: add banners
@LeeTZ LeeTZ closed this as completed Sep 25, 2018
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

No branches or pull requests

5 participants