sharing web resources across modules

I've tried a couple of approaches with no success. Would appreciate some help.

I have several modules (web apps) in my intellij 11.1.5 project. I would like to share selected source (js, jsp, css) from one of my modules as web resources in other modules. For instance:

Mod1     /mod1

Mod2     /mod2

I would like to make the contents of Mod1's shared directory available under the Mod2 web root (minimally at runtime) so that the following URLs work:


Thanks for your help.

Comment actions Permalink

If you only need these files at runtime the simplest way is to include 'shared' directory into an artifacts layout: open File | Project Structure,
select 'Artifacts' item, choose web artifact for 'mod2' application and add 'shared' directory to the output layout tree using '+' -> 'Directory
Content' action.

Nikolay Chashnikov
"Develop with pleasure!"

Comment actions Permalink

Nikolay, thanks for responding.

I've made the change you suggested but getting HTTP 404 when trying to get one of the "shared" resources of mod1 under mod2 url.

Specifically, given:



I added mod1 shared directory under mod2 artifact as Directory Content.

I tried to access t.jsp as http://local/mod2/shared/jsp/t.jsp and got 404.

What I noticed is that the mod1 shared directory (and its sub-directories) where copied under /out/artifacts/mod2_war_exploded but without any of the files contained in these directories.

What am I doing wrong?

Also, can you explain...if I change the contents of mod1/web/shared directory (or subs) will these changes automatically be reflected in mod2? That would be my intent.




Please sign in to leave a comment.