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
Post by Jeff MAURYWhen 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
On Thu, Dec 15, 2016 at 10:36 AM, Nicholaos Petalidis
Apologies if this has been answered before, but I 've been trying
to make my build process behave the same way as Eclipse does, but
with minor success.
The thing I don't understand is that when tests run through the
tycho-surefire-plugin seem to pick-up different classpaths than
when they run from within eclipse. This is particularly evident
with logging frameworks such as log4j or commons-logging that
expect for log configurations to be on the classpath and I simply
cannot find a way to configure both eclipse and tycho-surefire to
behave the same.
Can someone point me to some documentation that explains how the
two differ in this respect?
Best regards,
Nikos Petalidis
Consulting Software Engineer
_______________________________________________
tycho-user mailing list
To change your delivery options, retrieve your password, or
unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/tycho-user
<https://dev.eclipse.org/mailman/listinfo/tycho-user>
--
Jeff MAURY
"Legacy code" often differs from its suggested alternative by actually
working and scaling.
- Bjarne Stroustrup
http://www.jeffmaury.com
http://riadiscuss.jeffmaury.com
http://www.twitter.com/jeffmaury
_______________________________________________
tycho-user mailing list
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/tycho-user
--
Entimo AG
Stralauer Platz 33 - 34 | 10243 Berlin | Germany
Tel: +49.30.52 00 24 133 | Fax: +49.30.52 00 24 101
***@entimo.com | http://www.entimo.com/
Vorstand: Jürgen Spieler (Vors.), Marianne Neumann
Aufsichtratsvorsitzender: Erika Tannenbaum
Sitz der Gesellschaft: Berlin, Germany | Handelsregister: HRB Berlin-Charlottenburg 85073