I'm using the Java extension for VSCode while working in a maven project. We have a private maven repository that is accessible over VPN, specified in my .m2 settings:
$ cat ~/.m2/settings.xml
... // some hidden things
<mirrors>
<mirror>
<id>nexus</id>
<name>Mirror</name>
<url>http://****/nexus/repository/public</url> // accessible only over our company's VPN
<mirrorOf>external:*,!dynamodb-local-oregon</mirrorOf>
</mirror>
</mirrors>
I can successfully add and install dependencies stored either on our Nexus repo or from maven central.
But every time I start VSCode, it complains that it cannot find a private dependency, and I have to refresh the Java project, which requires that I be on VPN and that I redownload the missing dependency. Other dependencies, like lombok or google cloud, never have this problem--or if they do they don't need to be on VPN to download them again. The "missing" dependency is definitely downloaded into my .m2
folder:
$ ls ~/.m2/repository/com/company/data/dependency
total 0
drwxr-xr-x 18 user staff 576 27 Jan 11:15 4.3.2-SNAPSHOT/
Why does VSCode "forget" about the dependency when I've already downloaded it and used it during previous sessions, and why do I need to download it again?
EDIT: It looks like because the dependency is a snapshot, it will try to download the most up to date version. Is there a way to make it silently fallback to using the existing artifact in my ~/.m2 folder when it cannot download a new version? I'm not sure why these versions are snapshots, since they don't change all that often.