• Post Reply Bookmark Topic Watch Topic
  • New Topic

Create jar file while excluding test directory?  RSS feed

 
Daan Heuvelbeuk
Ranch Hand
Posts: 85
MySQL Database Netscape Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is it possible to exclude a directory containing test classes when creating a jar file?

I created an application with Eclipse. To test functionality I created some test classes. These classes do not have to be included in my jar file.

MyApplication is part of the foo.bar package. To test the application I also have a foo.bar.test directory.

My directory structure looks like:


manifest.txt contains:

I would jar this with:

And as far as I can see (jarring is on verbose) MyTest1.class and MyTest2.class are both included in the jar file.


 
Rob Spoor
Sheriff
Posts: 21131
87
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You could start using Maven. It has out-of-the-box support for unit testing. In short, your project would be structured as follows:

pom.xml contains the project configuration. It should include a section to create the JAR file including manifest entries. For instance:

The part between manifestEntries will replace your manifest.txt file, so that can be removed.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!