How to make a jar from a subpackage only?


I have a project with one main package and many subpackages.

I don't want to include all the subpackages in the jar file, but I can't figure out how to select only the subpackages that I want to include in my jar file.

It seems like it's all or nothing. When I click on available resources, the only option I get from my project is "Compile Output" (Which includes everything) and the libraries I use in my project.

As a workaround I could start a new project, but would like to avoid this.

Any help would be greatly appreciated.

(Using Idea 9.x)

Comment actions Permalink

Please take a look at ANT.

Comment actions Permalink

Thanks Tom.
I was looking for something a bit more point'n'click.

Does IDEA offer such a functionality?

Comment actions Permalink

You can press '+' button under 'Output Layout' tab, select 'Directory Content' element and choose output directory for the subpackage.

However it would be better to create a separate module and move the subpackage into it. This will guarantee that subpackage doesn't depend on classes
from other packages.

Nikolay Chashnikov
Software Developer
JetBrains, Inc
"Develop with pleasure!"


Please sign in to leave a comment.