[TIP] Merged properties

11 views
Skip to first unread message

Peter Kriens

unread,
Dec 7, 2020, 9:35:58 AM12/7/20
to via bndtools-users
A common practice is to specify build information in the different files of the bnd inheritance hierarchy. Since properties overwrite parent properties with the same name, it became awkward to manage this namespace. I therefore came up with _merged_ properties idea around 2015. 

The `-buildpath` instruction is not just the literal property `-buildpath`, it is the combined value of all visible properties in the inheritance tree that _start_ with `-buildpath` and are not overridden. So you can set `-buildpath.base` in `build.bnd` and `-buildpath` in `bnd.bnd`. The buildpath used by bnd is then the combination of these two.

For example, the following setup:

cnf/build.bnd:
...
-testpath.base: \
osgi.enroute.junit.wrapper,\
osgi.enroute.hamcrest.wrapper


<project>/bnd.bnd:
...
-testpath: \
assertj-core
This setup gives -every_ project by default access to junit and its dependency ham crest, while being able to add extra dependencies specifically per project.

The feature depends on the actual instruction, not all instruction support this feature.

See merged properties for more details.

Kind regards,

Peter Kriens

Reply all
Reply to author
Forward
0 new messages