More convenience for Maven Repos

The MavenBndRepository is one of the bnd workhorses. However, it is always kind of work to setup the plugin and the separate Maven Group:Artifact:Version file feels a bit superfluous. You can set the GAVs in the bnd file with the source option but there should be a better way …

I’ve just committed new version of bnd that will look for file that end in .pmvn in the cnf/ext directory. The ext directory was already used to extend the properties with bnd files. If you add a bnd file, then the workspace would have those properties as base.

For example, to add some dependencies to Maven Central you can create a file cnf/ext/example.pmvn:

biz.aQute.bnd:biz.aQute.bndlib:7.0.0
biz.aQute.bnd:aQute.libg:7.0.0
biz.aQute.bnd:biz.aQute.launchpad:7.0.0
biz.aQute.bnd:biz.aQute.bnd.runtime.gogo:7.0.0
biz.aQute.bnd:biz.aQute.bnd.runtime.snapshot:7.0.0
biz.aQute:biz.aQute.osgi.templates:1.10.0

If you run the latest the latest snapshot (7.1, later dan April 4) in Bndtools, then you should see a example.pmvn repository.

image

In this case the defaults are used but you can set specific properties in the comments. For example, to add a releaseUrl and the name, you could do the following.

# name = Example
# releaseUrl = https://repo.maven.apache.org/maven2/
biz.aQute.bnd:biz.aQute.bndlib:7.0.0
biz.aQute.bnd:aQute.libg:7.0.0
biz.aQute.bnd:biz.aQute.launchpad:7.0.0
biz.aQute.bnd:biz.aQute.bnd.runtime.gogo:7.0.0
biz.aQute.bnd:biz.aQute.bnd.runtime.snapshot:7.0.0
biz.aQute:biz.aQute.osgi.templates:1.10.0

The property names are defined in the Maven Bnd Repository

The same mechanism also works for the OSGiRepository. You can dump an OBR XML file but give it the extension pobr. The reason for these ‘odd’ extensions is that before this release, only .bnd files were inspected and it was common to add the data files in the same ext directory.

2 Likes

On that note a little additional update:
There has also been some work in BndEditor build.bnd: Plugin list should detect plugins by prefix by chrisrueger · Pull Request #6069 · bndtools/bnd · GitHub to make managing the Plugins in build.bnd easier. This means:

  • now you see the Plugins (before this was only working without merged properties)
  • also inherited repositories are shown greyed out
  • you can edit plugins (also works for MavenBndRepository)
  • remove plugins

Hoping both of the above and this improve usability of managing repositories.
This is in the latest snapshot.

Together with Peter’s work on a new Workspace Fragment Template support mechanism this adds new ways to extend and configure a bndtools workspace. Looking forward how this will look when it all comes together.

1 Like