Version=project vs. version=latest

On this post from 2015 https://groups.google.com/g/bndtools-dev/c/pKdZ2fQZ0KE/m/PZuWBD9HLvkJ you can read:

  • We now faithfully use the build JAR file instead of the bin folder with version=latest. Version=project uses the bin folder directly. Using the JAR means that any extra packaged code will be visible in downstream projects.
  • We probably need to watch upstream dependency’s bin folder if version=project. In practice, this generates a new compile for downstream projects, which should trigger the bnd build. However, there could be a possibility we do not pick up changes. Needs some further thought.

Could somebody elaborate about the impact of having version=project vs. version=latest on the -buildpath in bnd.bnd?

  • When is the one or the other recommended for workspace-bundles?
  • Does this e.g. have an impact on Eclipse build performance?
Summary

One thing we noticed that for bundles which export some packages of “wrapped” external libs, we need to use version=latest, because otherwise those exported packages are not visible, because of…

“Using the JAR means that any extra packaged code will be visible in downstream projects”

But for other pure-workspace bundles version=project works fine.

version=project uses the bin folder of the project. This is only the classes compiled in the project and would not include any packages the bundle includes from the buildpath.

version=snapshot uses the project’s built bundle from the generated folder. So this will include all packages in the built bundle.

version=latest uses the latest version of the bundle. This is generally the project’s built jar from the generated folder but could mean a bundle from the configured repositories if the project is for some reason building an earlier version than is available in the repositories.

You generally don’t want to use version=project unless the project does not build a bundle that is used at runtime. The aQute.libg project in Bnd is like this. It is just a collections of utility package which other bundles in the build conditionally include as implementation details.

version=snapshot or version=latest are the proper choices since they refer to an actual bundle and not a bin folder.

2 Likes