Creating a minimal stand alone maven integration test

I’m trying to derive a minimal stand alone project that uses:

  • bnd-testing-maven-plugin
  • osgi-test

I’m using the example at osgi-test/examples/osgi-test-example-mvn at main · osgi/osgi-test · GitHub what runs fine when executed with mvn verify so one could assume that it somehow works and everything is setup as required.

Still using this to create a standalone-example seems to fail and neither the documentation nor the debug output gives appropriate hints how to proceed here.

What I have tried so far is available here: org.ops4j.pax.jpa/pax-jpa-itest at osgi-test-setup · ops4j/org.ops4j.pax.jpa · GitHub

It contains the following steps:

  1. JUnit 5 + osgi-test depedencies (no other dependencies right now to keep it simple)
  2. a simple test.bndrun file (the goal is to derive as much things as possible as no BND-IDE is used)
  3. bnd-maven-plugin to package the test-classes in a jar (this works and seems to produce a jar with proper manifest)
  4. bnd-resolver-maven-plugin to calculate the dependencies
  5. disables maven-surefire-plugin
  6. bnd-testing-maven-plugin to run the integration tests

Sadly it already fails at step (4)

[ERROR] Resolution failed. Capabilities satisfying the following requirements could not be found:
⇒ osgi.identity: (osgi.identity=pax-jpa-itest)

Here I’m a bit stuck, as would understand any dependency not found but here it seems the test-probe itself is not found.

Can you share your project (git repo link)?

See org.ops4j.pax.jpa/pax-jpa-itest at osgi-test-setup · ops4j/org.ops4j.pax.jpa · GitHub

Ok, bear with me a bit and I will try to find some time to put together an onboarding/howto document. I’ll start with maven since that’s the comfort zone for me right now.

Thanks, maven would be totally fine. I wish there would be a maven-osgi-test-plugin that one simply enables like surefire and everything else happens magically in the background :sweat_smile:

You are missing

in your resolve execution. So your test bundle is unknown to the resolver.

@bjhargrave If you are using bnd plugins 6.1.0 or later that is not strictly needed since we add all artifacts attached to a project to the implicit repo.

Good to know, I will remove those lines from the mvn example then!

I also tried adding the

<bundles>
	<bundle>${project.build.directory}/${project.build.finalName}-tests.jar</bundle>
</bundles>

just to be sure, but the error remains.

@rotty3000 @bjhargrave just wondering if you have any further tips what might be setup wrong here? Do you need any further information?