bndtools / bnd

Bnd/Bndtools. Tooling to build OSGi bundles including Eclipse, Maven, and Gradle plugins.
https://bndtools.org
Other
532 stars 305 forks source link

Add Xray annotation to bnd test leads in failed resolution #6278

Closed mi-schi closed 2 months ago

mi-schi commented 2 months ago

Hi,

Xray is a plugin for Jira to manage tests as tickets. To be able to see the test results in Jira I want to link these Jira tests with the OSGi tests.

First I add Xray in the pom.xml:

<dependency>
    <groupId>app.getxray</groupId>
    <artifactId>xray-junit-extensions</artifactId>
    <version>0.8.0</version>
</dependency>

Then I add the xray annotation above the test:

import app.getxray.xray.junit.customjunitxml.annotations.XrayTest;

class {
  @XrayTest(key = "JIRA-123")
  void test() {
  }
}

Normally that's all. Source: https://docs.getxray.app/display/XRAY/Testing+web+applications+using+Selenium+and+Junit5+in+Java#tab-API

When I run the test, I get the error:

[ERROR] Resolution failed. Capabilities satisfying the following requirements could not be found:
                ...
                              ⇒ osgi.wiring.package: (osgi.wiring.package=app.getxray.xray.junit.customjunitxml.annotations)

Failed to execute goal biz.aQute.bnd:bnd-resolver-maven-plugin:6.4.0:resolve (resolve-test) on project sample-project: Unable to resolve <<INITIAL>>: ... missing requirement osgi.wiring.package;filter:='(osgi.wiring.package=app.getxray.xray.junit.customjunitxml.annotations)';osgi.wiring.package='app.getxray.xray.junit.customjunitxml.annotations']]] 

I don't understand the problem. I suspect that there is an annotation reader in bnd that cannot handle Xray annotation. Does anyone have any idea what's going on in the background?

Thanks, Michael

pkriens commented 2 months ago

please make a minimal repo that shows this on Github so we can test.

mi-schi commented 2 months ago

Okay I will create a sample project, till then

mi-schi commented 2 months ago

Here is the sample project: https://github.com/mi-schi/sample-test-xray Thank you for investigating :)

pkriens commented 2 months ago

Ok, the JAR is not a bundle. This works ok for compiling but you can only resolve bundles. This JAR misses the manifest needed to grow up to a well functioning bundle ...

You need to wrap it to a bundle JAR or include it in one of your own JARs.