Bela Tamas Jozsa
Bela Tamas Jozsa

Reputation: 714

Test Bundle cannot find the Bundle to be tested

I have configured an std project setup for tycho projects. build works very well:

[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]   

[INFO] root .................................. SUCCESS [  0.152 s]
[INFO] bundles ............................... SUCCESS [  0.008 s]
[INFO] com.project.pcbcalculator ............. SUCCESS [  3.649 s]
...(Other artifacts like target, features).... SUCCESS [.........]
[INFO] com.project.pcbcalculator.tests ....... FAILURE [  4.693 s]

except testing. I always get runtime error (13)

!MESSAGE Missing required bundle **com.project.pcbcalculator_1.0.0**

!ENTRY org.eclipse.osgi 4 0 2018-06-05 18:51:19.816
!MESSAGE Application error
!STACK 1
java.lang.RuntimeException: Bundle **com.project.pcbcalculator.tests** is not 
found

Analyzing the console log I came to the conclusion that the test project cannot be started because the budnle to be tested is not loaded.

The question is why, and how can I change. According to the tutorials alls should be fine, and tycho is able to compile the main bundle

Upvotes: 2

Views: 368

Answers (2)

R4de
R4de

Reputation: 87

Late answer but it might help. Problem with me was that maven was using java 8 but my project required java 11. You can use mvn -v in terminal and it will tell you java version that maven is using. I followed https://askubuntu.com/questions/740757/switch-between-multiple-java-versions and changed version. After changing remember to also log out and log in and try again in new terminal.

Upvotes: 0

Marek Jagielski
Marek Jagielski

Reputation: 822

Please add org.eclipse.equinox.console to Require-Bundle.

Look in logs for the command that execute your test:

[INFO] Command line:
    [/usr/lib/jvm/java-8-openjdk-amd64/bin/java, -Dosgi.noShutdown=false, -Dosgi.os=linux, -Dosgi.ws=gtk, -Dosgi.arch=x86_64, -Dosgi.clean=true, -jar, /home/lupus/.m2/repository/p2/osgi/bundle/org.eclipse.equinox.launcher/1.5.100.v20180827-1352/org.eclipse.equinox.launcher-1.5.100.v20180827- ...

Remove commas and adding to the end

-noExit -console

Run the command. You should get the same exception java.lang.RuntimeException

Click once again and you shoud see 'osgi>' prompt.

Run

osgi>diag com.project.pcbcalculator.tests .

You should see in more details what is missing in your target.

Upvotes: 0

Related Questions