Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Buckminster » Exclude test classes from jar file
Exclude test classes from jar file [message #758788] Thu, 24 November 2011 14:51 Go to next message
Bernhard Lutzmann is currently offline Bernhard LutzmannFriend
Messages: 9
Registered: March 2010
Junior Member
Given a plug-in which consists of two source folders "src" and "test". How do I exclude the test classes from ending up in the generated jar file?

I tried to achieve that via excludes in "build.properties" but without success. Any hints?
Re: Exclude test classes from jar file [message #758793 is a reply to message #758788] Thu, 24 November 2011 15:09 Go to previous messageGo to next message
Matthew Webber is currently offline Matthew WebberFriend
Messages: 198
Registered: December 2010
Senior Member
Your starting point is the problem. We don't put our source and test code in the same plugin. Instead, for each plugin we have a separate test fragment (http://rcpquickstart.com/2007/06/20/unit-testing-plug-ins-with-fragments/).

Our feature projects (for the products we build) do NOT include the test fragments, which means test code does not get included in the built product. However, each host plugin has a buckminster.cspex which lists the test fragment as a dependency - note however that it's NOT listed in the manifest as a plugin dependency. This ensures that that when a developer checks out (materializes) a plugin, they also get the associated test fragment.

Hope that helps
Matthew
Re: Exclude test classes from jar file [message #758864 is a reply to message #758793] Thu, 24 November 2011 19:53 Go to previous messageGo to next message
Alan Underwood is currently offline Alan UnderwoodFriend
Messages: 37
Registered: October 2010
Member
Another thought on test plug-in organization. We have test plug-ins also as fragments but we have a test feature that complements each non-test feature, and the test feature provides the test plug-in fragments. Our 'site' feature which contains the cquery and rmap includes the top level application feature and the top level test feature. Thus, when you materialize with the cquery, you get the plug-ins and the test fragments.

Also you can set the eclipse preferences to display missing plug-ins from a feature as errors, so as a developer, you know if you are missing any test plug-ins.

Alan
Re: Exclude test classes from jar file [message #758914 is a reply to message #758864] Fri, 25 November 2011 08:53 Go to previous messageGo to next message
Matthew Webber is currently offline Matthew WebberFriend
Messages: 198
Registered: December 2010
Senior Member
Thanks for sharing your set-up Alan. That's quite a neat way of doing it.
Matthew
Re: Exclude test classes from jar file [message #758941 is a reply to message #758914] Fri, 25 November 2011 11:06 Go to previous messageGo to next message
Bernhard Lutzmann is currently offline Bernhard LutzmannFriend
Messages: 9
Registered: March 2010
Junior Member
Thanks for the responses.

Yes, I was also thinking about using test fragments. And it seems when using Buckminster this is the proper way.
The only side-effect that I don't like is that the number of projects grow.

Bernhard
Re: Exclude test classes from jar file [message #758975 is a reply to message #758941] Fri, 25 November 2011 12:45 Go to previous message
Thomas Hallgren is currently offline Thomas HallgrenFriend
Messages: 3232
Registered: July 2009
Senior Member
On 2011-11-25 12:06, Bernhard Lutzmann wrote:
> Thanks for the responses.
>
> Yes, I was also thinking about using test fragments. And it seems when using Buckminster this is the proper way.
> The only side-effect that I don't like is that the number of projects grow.
>
I would consider that a good sign. ;-)

- thomas
Previous Topic:How can I materialize both: target platform and source code into workspace in one go?
Next Topic:"The resource is a duplicate ... and was not copied to the output folder"
Goto Forum:
  


Current Time: Fri Dec 19 22:53:36 GMT 2014

Powered by FUDForum. Page generated in 0.01599 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software