Closed amitjoy closed 3 years ago
It seems the properties specified in the sub bnd files of a project are being considered while resolving any bndrun inside it.
This [1] is where the results started to differ.
[1] - https://github.com/bndtools/bnd/commit/c5b1a580820c7615bff7bc27bd5a34bd59a73a42
Bndrun files do not include or consider the bnd.bnd file of a project. A bndrun file's parent is the workspace.
The referenced change now infers a -runrequires
using the project's built artifacts IF a -runrequires
is not specified. I assume your bndrun file specifies a -runrequires
instruction and then no inferred -runrequires
is added.
In looking at your project, there is no -runrequires
instruction specified. Just merged properties. So you can fix by specifying an empty -runrequires
in the bndrun file.
-runrequires:
Thx @bjhargrave for your quick response. Actually the initial requirements (-runrequires
) are inherited from included bnd files and that's why there is no initial requirements (-runrequires
) specified in the bndrun file. If I understood you correctly, according to the current changes, if there is no visible initial requirements (-runrequires
) specified in the bndrun, the initial requirements will be inferred automatically. I will give it a go and let you know.
Actually the initial requirements (
-runrequires
) are inherited from included bnd files
As far as I could see there is no -runrequires
instruction anywhere. Just -runrequires.dev
, etc. merged instructions. So if you specify an empty -runrequires
somewhere, the plugin will not infer a -runrequires
instruction.
de-lcl-gcm.bndrun
includes the following:
-include: \
shared/base.bndrun,\
\
shared/dev.bndrun,\
shared/lcl.bndrun,\
shared/gcm.bndrun
and shared/dev.bndrun
includes shared/frm.bndrun
which contains the following initial requirements:
-runrequires.frm: \
bnd.identity;id='org.apache.felix.converter'
shared/dev.bndrun
itself includes the following initial requirements:
-runrequires.dev : bnd.identity;id='biz.aQute.remote.agent'
So, as a result, the following initial requirements are inherited:
-runrequires.dev : bnd.identity;id='biz.aQute.remote.agent'
-runrequires.frm: \
bnd.identity;id='org.apache.felix.converter'
If I resolve the bndrun in Eclipse using Bndtools 6.0.0-SNAPSHOT
, the following bundles are picked up by the resolver even though there is no initial requirements specified in the bndrun directly:
So, as a result, the following initial requirements are inherited:
They are not inherited. They are merged properties. https://bnd.bndtools.org/chapters/820-instructions.html#merged-instructions
-runrequires.dev
!= -runrequires
and -runrequires.frm
!= -runrequires
.
The resolve operation will merge them all together, but the plugin code only considers -runrequires
because one may want to specific some additional requirements in addition to the inferred requirement from the project's built artifacts. (The gradle plugin tests test this.)
Since you do not want to infer -runrequires
from the project's built artifacts, you must specify an empty -runrequires
.
Yes, inferring -runrequires
and -runee
in the maven and gradle plugins is different from the Bndtools UI. So if you don't want to infer in the maven and gradle plugins, it is best to explicitly set -runrequires
and -runee
in the bndrun.
Thx @bjhargrave for clarifying this. Does it also mean that all the -runX
instructions should be specified as empty in all the bndruns? In our project, we follow merged properties everywhere so that several bndruns can easily inherit them from a single point of access.
Only -runrequires
and -runee
are inferred, if not set, by the maven and gradle plugins.
Thx a lot, @bjhargrave 👍 I will configure the workspace accordingly and let you know how it looks.
Works like a charm 🚀 Thanks @bjhargrave for your continuous support 👍
But this means the result is different between Eclipse &Gradle in a bnd workspace? That sounds dangerous?
Using the latest version of
6.0.0-SNAPSHOT
, the resolve operation result in Gradle differs from the result in IDE. Here is a sample project to reproduce the issue.How-To:
./gradlew :com.qivicon.product.grappa.application:resolve.dev-lcl-gcm --info