• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Create jar file while excluding test directory?

 
Ranch Hand
Posts: 89
Netscape MySQL Database Windows XP
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.


 
Sheriff
Posts: 22783
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
No, tomorrow we rule the world! With this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic