Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
388 views
in Technique[技术] by (71.8m points)

java - JUnit Plug-in Tests Ignoring Target Platform

I've used the archetype from the tycho-eclipse-plugin-archetype to create a simple Eclipse plug-in with a working integration test project. Except... it doesn't.

When I start any test as "JUnit Plug-in Test" I get the following exception:

!ENTRY org.eclipse.osgi 2 0 2016-01-07 14:43:35.734
!MESSAGE One or more bundles are not resolved because the following root constraints are not resolved:
!SUBENTRY 1 org.eclipse.osgi 2 0 2016-01-07 14:43:35.734
!MESSAGE Bundle initial@reference:file:../../../../../../../Users/MyName/.eclipse/org.eclipse.platform_4.5.1_2043537226_win32_win32_x86_64/plugins/org.eclipse.pde.junit.runtime_3.4.500.v20150423-1241.jar/ was not resolved.
!SUBENTRY 2 org.eclipse.pde.junit.runtime 2 0 2016-01-07 14:43:35.734
!MESSAGE Missing required bundle org.eclipse.core.runtime_[3.11.0,4.0.0).

(And some similar messages for other plug-ins.)

Which is weird, because my target platform contains org.eclipse.pde.junit.runtime 3.4.300, not 3.4.500, which requires org.eclipse.core.runtime version [3.3.0,4.0.0). The run configuration for the test case agrees with that version and attests "No problems were detected."

So from the fact that the path contains "/org.eclipse.platform_4.5.1" I assume that it takes the currently running Eclipse target platform, even though there's another set in the workspace and in the run configuration.

How do I change JUnit plug-in tests to take the currently active target platform?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

It works in Eclipse 4.4.2 (Luna), so it's probably one of the "features" of Eclipse Mars.

Addition: As explained here, Eclipse uses plug-ins from the application folder when it can't find them in the workspace's target platform. This makes the tests fail when the workspace and Eclipse target platform differ. The solution is to a) use the same Eclipse version for development and the project or b) use a cristall ball to figure out which test plug-ins are missing and add them to the project's target platform.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...