File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Ant, Maven and Other Build Tools and the fly likes Build Single Module with Dependencies Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "Build Single Module with Dependencies" Watch "Build Single Module with Dependencies" New topic

Build Single Module with Dependencies

Niall Loughnane
Ranch Hand

Joined: Dec 07, 2006
Posts: 208

I have a project where there are multiple modules within the project base pom.xml,

There is a module "moduleA" that is a standalone JAR that is dependent on another module "moduleB" within the project,

Is it possible to build module "moduleA" JAR file and within this JAR file there will be a lib folder that contains module "moduleB" code,

Thanks in Advance,

Peter Johnson

Joined: May 14, 2008
Posts: 5852

You can use the Assembly plugin to do this.

By the way, the default classloader will not load a nested JAR, so you will need some code to do that (if Eclipse builds a JAR with nested JARs it includes such a classloader). You might be better off just adding the classes from module B into the JAR for module A; and not in a lib folder because that will mess up the classpath.

JBoss In Action
I agree. Here's the link:
subject: Build Single Module with Dependencies
It's not a secret anymore!