-
-
Notifications
You must be signed in to change notification settings - Fork 302
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
MavenBndRepository does not download remote updates to snapshot jars #6427
Comments
Could you elaborate how you determine that the latest version is not used? I mean do you look somewhere (e.g. BND'S Jar Viewer) and see outdated info? or do you notice it in the running code which still seems to use an old version? When your CI process publishes your bundle to your m2 repo, does it always use the same version e.g. ca.uvic.onc:oceans-next:0.1.0-SNAPSHOT ? From https://bnd.discourse.group/t/caching-mvn-source-jars-multiple-downloads-on-eclipse-start/244/3 I read:
So in your case a re-"download" is not needed, since you always use the same version and it is already there. Some thoughts:
|
The code isn't easily distinguishable between different versions. Yesterday I was mostly relying on the jar's mod time from
According to my understanding of Maven - which might be flawed - a "-SNAPSHOT" version overrides the normal versioning rules: maven-metadata.xml contains the "true" version, based on the publish timestamp and the number of previous publications, and should update the jar if the metadata indicates it's out of date. As far as I can tell, bnd is trying to handle this from #4280 by forcibly updating snapshot jars on refresh. On bndtools 7.1.0:
However, I had no idea you could right-click on artifacts in the repository browser: doing this displays an option "Refresh snapshot". I've figured out that I can update the jar with
It's a little unfortunate that this requires so many extra steps beyond simply refreshing the repositories tree (especially since this is just a runtime dependency and needing to reload the workspace causes a lengthy rebuild), but it does seem to work. |
Thanks @pconley-onc for the additional info. I have no solution yet but did some more debugging to find out what is happening under the hood:
I can confirm that after "Clear from Cache" only a bndtools explorer / Reload workspace triggers a re-download from remote maven Regarding your sentence:
Do you mean this timestamp in the JarViewer? (red arrow) also
Potential separate JarViewer bug: It is caused that the JarViewer somehow does not handle the just-deleted file properly which has a null:// FileStore (may in ConclusionIn my opinion Clear from Cache is what you need since it deleted the folder in your local maven repo e.g. It is to be discussed when a re-download should be triggered (currently it seems only bndtools explorer / Reload workspace is triggering a re-download). a) maybe Clear from Cache should automatically trigger a re-download |
Yes, that's the one (with the "Last Modfied" typo)
One folder is created when I open the jar in the editor, then deleted when I close it. I neglected to mention that when I do "Refresh snapshot" and try to open the jar in the jar editor, I get the following dialog: Clicking "Yes" appears to do nothing.
It would be most convenient for me & my team if "Refresh snapshot" triggered the re-download itself, but I'm obviously unaware of what other considerations exist. The existing three-step process is adequate. |
Thanks for the screenshot. I have not seen this dialog, but I did not test with a snapshot but a normal revision. I try to have a look. |
Bndtools version: 7.0.0 (Git-Descriptor: 7.0.0.RC2-3-gb82dc867a; Git-SHA: b82dc86) and 7.1.0 (Git-Descriptor: 7.0.0.DEV-1660-g47e504d78; Git-SHA: 47e504d)
Java version: OpenJDK 64-Bit Server VM Temurin-17.0.3+7 (build 17.0.3+7, mixed mode)
OS: Ubuntu 22.04
We have a non-bnd OSGi bundle being published to a private Maven repository several times daily by CI. I'm trying to use this bundle in a bnd workspace through a MavenBndRepository, but it's not being updated properly: the bundle was initially downloaded correctly, but now that new versions have been published, clicking on Refresh Repositories Tree doesn't download them.
My configuration is as follows. build.bnd has a plugin (among others)
onc.maven:
When opened in Eclipse, the jar reports a Last Modified timestamp of 2025-01-10T16:56:34Z (this is wrong - it's actually 16:56:34 at UTC-8, but I assume this isn't a problem); this matches lastModified value in ~/.m2/repository/ca/uvic/onc/oceans-next/0.1.0-SNAPSHOT/maven-metadata-D1C6EDBA.xml, which contains (among other things)
However, the latest version according to our Maven repository's maven-metadata.xml is
Clicking Refresh Repositories Tree doesn't download the new metadata file or the new jar, and doesn't log any errors. It appears that re-launching Eclipse sometimes updates the jar, but I haven't been able to reproduce that reliably.
In case it makes a difference, I do have a ~/.m2/settings.xml containing
I don't know whether this is a bndtools issue or my own problem.
The text was updated successfully, but these errors were encountered: