Dependencies on web facets?

We need to split out our JSP and CSS / JS files into different modules. Part of the reason is that the JSP's are to be hosted on Tomcat and the CSS / JS files are to hosted on an Apache front end. Also part of the reason is that for production deployment we want to combine and minify all those CSS & JS files into one, whilst still keeping their modularity in our development environment. In short, we think that keeping them as seperate IDEA modules is the best way to manage all that.

We have a Root module for the JSP files, and in our localhost run configuration that deploys to /
And we have a Static module for the CSS & JS files, and in our localhost run configuration that deploys to /static

So far no problem - each module has to have a seperate path on Tomcat. In the IDEA Root module we mark a module dependency on the Static module.

Here is where the problem lies - in the Root module in my JSP page I write:
<script type="text/javascript" language="Javascript" src="/MyCss.css"></script>

IDEA finds the MyCss.css file in the Static module and all is great in the editor. But it doesn't work at runtime cause the Static module is mounted on /static!

If instead I write:
<script type="text/javascript" language="Javascript" src="/static/MyCss.css"></script>

It works fine at runtime, but IDEA can't find the css file inside the editor so I get a yellow warning. And I can't ctrl-click to go directly to the css source.

Does anyone know how to solve this so that seperate web modules work fine in both the editor and at runtime?

3 comments
Comment actions Permalink

Hi.

You can try the following. Go to Static module settings, web facet settings. Check "Web Resource Directories" table. Make sure that the web root you use has /static prefix in "Path Relative to Deployment Root". Hope this helps.

Alexander.

0
Comment actions Permalink

Unfortunately this doesn't work. The run configuration shows that the root module gets delployed to / and the Static module gets deployed to /static. So if I set "Path Relative to Deployment Root" to /static as well, the CSS file becomes /static/static/MyCss.css at runtime (instead of just /static/MyCss.css as intended).

0
Comment actions Permalink

Any ideas on how to do this?

0

Please sign in to leave a comment.