Hi nikos,
This is what we did to solve the log4j classpath problem.
We used a separate fragment to attach a single log4.properties to
e.g. apache.log4 bundle and therefore can be found when log4j
starts up. The fragment only consists of a src folder with
log4j.properties in it.
This fragment must then be added to tycho-surefire classpath
configuration because a fragment won't be picked up otherwise to
start with test OSGi runtime.
snippet from test parent pom:
...
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>target-platform-configuration</artifactId>
<configuration>
<dependency-resolution>
<!--
http://dev.eclipse.org/mhonarc/lists/tycho-user/msg03464.html
-->
<!-- <extraRequirements> lists
all the optional bundles that must be
on the classpath. -->
<!-- logging fragment to provide
logging.properties in classpath root -->
<!-- combine.children only required if
any parent pom already defines extraRequirements, too -->
<extraRequirements
combine.children="append">
<requirement>
<type>eclipse-plugin</type>
<id>com.XXX.tst.frw.common.logging</id>
<versionRange>0.0.0</versionRange>
</requirement>
...
This approach will work out of the box for JUnit-
Plugin
tests started from Eclipse workbench (with all Plugins from
workspace and target platform enabled). The fragment will be
resolved and supplies its log4j.properties to the classpath of
host log4j bundle.
There is one drawback, however. We strive that plain JUnit tests
can be executed equally from within Eclipse, not only JUnit Plugin
tests. As a plain JUnit test does not know about fragments, the
fragment project needs to be checked out and added to test
project's Project Dependencies in build path
(BuildPath->Configure Build Path). This is a bit cumbersome,
but manageable for us.
So, if you are working only with JUnit plugin Tests anyway, this
won't affect you. If there is a more elegant solution for plain
JUnit tests, I'd be pleased to hear about it.
Hope this helps.
Kind regards
Henrik
Am 15.12.2016 um 11:18 schrieb Jeff MAURY:
When you run a plugin test from Eclipse, the
classpath is computed according to your target platform and your
workspace.
When tests are run from Tycho, the classpath is computed
from the target platform that you configured. It is possible
to configure the Tycho surefire plugin to exclude some bundles
or add new ones.
Hope this helps
Jeff
_______________________________________________
tycho-user mailing list
tycho-user@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/tycho-user