-
Notifications
You must be signed in to change notification settings - Fork 12
VS Code cannot access maven dependencies #2
Comments
I am not sure of the eclipse behaviour. |
This is related to appsody/stacks#127. There are some issues with the m2 initialization that needs to be ironed out. |
The appsody team had made changes to fix this. Both spring and the microprofile now mount the maven cache location and files get copied there during the init/run. As a result, the dependencies would be copied to the maven cache and be made known to the IDE. |
On Eclipse, the workaround is:
If the m2 cache is already set up, then this workaround might not be needed - Any subsequent new projects will be configured properly. |
I'm coming to this as an Appsody-outsider, so feel free to poke holes in my logic 😃 . The general problem of sharing the Maven cacheIn Maven, dependency/plugin jar files are stored in an All JAR files that are downloaded by Maven are stored in this directory, including external dependencies referenced as Unfortunately, this Fortunately, this is rarely an issue in practice, because the user manually controls when a build takes place, and can ensure that only one process is active at a time (or they delegate this responsibility to their IDE). Specific to AppsodyMy assumption (correct if wrong) is that in order to attempt to solve this bug, Appsody and this PR are bind mounting the user's This means we have introduced the possibility for two different processes (Appsody, and the user's IDE) to concurrently read/write from this directory. This would likely be fine if Appsody only had manually-triggered builds (eg no "auto-rebuild"), but Appsody listens for source file changes within the container and automatically initiates a Maven build when one is detected. So now both Appsody, and the user's IDE, are simultaneously listening for changes to source code files (or build artifacts), and both will automatically start a Maven build -- using that shared cache dir -- once a change is detected:
When and how often will it happen?I think the burden of proof that this is safe is on the implementor of the Appsody PR above (rather than me, attempting a disproof of safety), but here are the scenarios where we are most likely to see issues:
As for how often, it's tough to model w/o experimentation, but it would depend on how often those 3 above events occur, and then it would depend on network I/O download speed (slower == more likely to occur) and disk I/O speed (likewise). What is the end result?As per the Maven bugs, when there are two concurrent writes to a dependency, it can corrupt those dependency JARs in the cache:
You will also get problems on concurrent write-read, but the above concurrent double-write problem is the most serious, as this leaves broken JARs in the cache, which will fail builds (perhaps permanently, with no obvious cause) and provide no obvious solution on how to fix. During the inception of Microclimate, while investigating how to speed up container builds, we specifically avoided sharing the It would be REALLY GREAT if this were concurrency safe, but inconveniently from our previous investigations, it is not. 😞 |
Thank you for the insights @jgwest. This is good information and a compelling reason we can take back to appsody team to push for moving the maven setup to the During our discussions for this problem, the idea of introducing a 2nd-stage init was floated around, which would run a containerized operation to setup up the parent pom (with m2 mounted, so much like what it is now done during Unfortunately we didn't get this 2nd-stage init, but hopefully appsody is still open to providing that, especially given the info you provided (or if we can get to running appsody outside of a containerized environment, then a 2nd-stage init might not be needed) |
Steps for Codewind for VS Code:
Other points to consider: To Debug:
|
Closing as this has been documented. |
After creating a new appsody Java project in Codewind for VS Code:
This causes numerous IDE features to not work such as intellisense and hitting debug breakpoints.
If you create an appsody project of the same type outside of codewind and then creating a new Codewind project of the same type, the new project will work. I expect that disabling/re-enabling would fix it too.
It sounds like the difference maker is that Codewind places the maven artifacts under
codewind-workspace/.extensions/appsodyExtension/.m2
while normally they are placed under~/.m2
which is where VS Code is looking for them.The text was updated successfully, but these errors were encountered: