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

JAR files are not refreshed after they are updated. #775

Closed
wtbcode opened this issue Jan 24, 2019 · 8 comments · Fixed by eclipse-jdtls/eclipse.jdt.ls#1002
Closed

JAR files are not refreshed after they are updated. #775

wtbcode opened this issue Jan 24, 2019 · 8 comments · Fixed by eclipse-jdtls/eclipse.jdt.ls#1002
Assignees

Comments

@wtbcode
Copy link

wtbcode commented Jan 24, 2019

[provide a description of the issue]

Environment
  • Operating System: Windows 10
  • JDK version: 1.8.0_171
  • Visual Studio Code version: 1.30.2
  • Java extension version: 0.37
Steps To Reproduce

I am working with Eclipse projects that do not use Maven or Gradle. We use ANT to build our JAR files and manually copy the JAR files to projects that depend on them as needed. What I am finding is that vscode will not pick up the changes in an updated JAR file unless I restart the editor. I have tried the "Java: Refresh" command in hopes that it would trigger whatever is happening on startup to recognize the JAR file update. I am hoping that there is a way to manually trigger a "project" reevaluation after these updates.

Current Result

I have to restart vscode to see JAR file changes.

Expected Result

vscode watches the file and automatically does the update or provides a command I can use to trigger the update.

Additional Informations
@yaohaizh
Copy link
Collaborator

I don't think this extension provide a command call "Java: Refresh".

Also, how do you copy the JAR files to the projects? Change the .classpath file or other way?

@wtbcode
Copy link
Author

wtbcode commented Jan 24, 2019

The ".classpath" file does not change. The JAR files do not have a version in their name (I know bad practice :)). So the only thing that changes is the JAR file itself.

@wtbcode
Copy link
Author

wtbcode commented Jan 24, 2019

The comment by "yaohaizh" tipped me off to a possible workaround. I "touched" the ".classpath" file in the project that was taking in the changed JAR and then the "linting" picked up a change without a restart of vscode.

I am still interested in a command to manually force this refresh (or something equivalent) but this workaround definitely helps.

@wtbcode
Copy link
Author

wtbcode commented Jan 24, 2019

The workaround of touching the ".classpath" file is not really working. When I save the source program referencing the new code (for example a new method in the updated JAR), the compile errors go away, but as soon as I make a single change to the file they come back which is odd.

@yaohaizh
Copy link
Collaborator

@wtbcode "Java: Force Java Compilation" works for you?

@wtbcode
Copy link
Author

wtbcode commented Jan 25, 2019

I went to test that just now by adding a new method, creating the JAR, and copying it over into the "dependent" project and it just worked immediately. Fearing for my sanity, I added another method into the same class and repeated the steps, and reproduced the usual behavior that the change was not picked up. I then started with the "incremental" forced compile and that did not work and moved to the "full" compile which cleared all of the compiler errors and worked away. I waited until the status bar indicated the compile was no longer occurring and my CPU had settled down. At that point, I did not have any compile errors. As soon as I edited the file, the compile error came back on the second method, which is a little disturbing.

The "intellisense" is in line with the compiler view of the classes. I get suggestions for the first method but not the second.

@fbricon
Copy link
Collaborator

fbricon commented Jan 30, 2019

where are the jars living? in the workspace or outside? If it's the former, we may be able to "refresh" the jar server-side, if vscode "watches" it, that "might" fix the issue.

@wtbcode
Copy link
Author

wtbcode commented Jan 30, 2019

All of our projects have a ".classpath" file with reference to JAR files in a "lib" directory within the project. In the ".classpath" file the entries look like this:

<classpathentry kind="lib" path="lib/dde-core.jar"/>

Basically the relationship between projects is pretty "old school". I build one project and then copy the JAR into another (through the OS) to satisfy compile dependencies. All of the projects are first level entries in a "c:\projects" directory (e.g. "c:\projects\foo") and the workspace file (*.code-workspace) is in the "c:\projects" directory.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment