Depend on another project?

A Convert from Netbeans to Intellij here.

I have a common library project, called A. I have a web project called project B.

How do I add the entire project A as a dependency to project B, such that if I add/remove/change any classes in A, when I recompile B it picks them up? So far all I seem to be able to do is create some kind of static dependency that is a snapshot of the classes in A at the time the dependency was created, so when I do something in A it is not being picked up by the code in B.



Comment actions Permalink

IDEA is more well-thought in regards of projects than Eclipse is and
Netbeans seems to be. In IDEA a project is self contained. If you want to
define dependencies between multiple parts of your project, define different


Comment actions Permalink

In IDEA that works on the level of modules.
Just add the module file of the library project to your web project. And create a dependency from the web module to the library module.

Comment actions Permalink

Thanks Tom & Stephen for the replies.

One thing I haven't been able to get working is the exported dependencies.

I have a project for B, with a module added for project A (the common library) as you suggested. Project A has a dependency on Apache Commons-Lang, which I created a global library and made it as a dependency of A.

In the module settings for A, I have the "export" option selected for this global library. When I do a full build of B, this dependency of A is not added to the distribution output. I had to manually add this global library to the "modules and libraries to package" section before it added it. What is the "export this dependency" option for in the module settings, if it is not propagating through to other modules that depend on it? How do I get this to happen automatically?



Comment actions Permalink

AFAIK the dependency configuration is for compile time only, i.e. without exporting a
common library from module A any modules that depend on A and use code from the
common library would not compile.

The packaging configuration indeed could use more sensible defaults.
I guess you should create a Jira issue at


Please sign in to leave a comment.