最好的位置把你的CSS和JS文件在一个Mavenized Java Web应用程序? [英] Best location to put your CSS and JS files in a Mavenized Java Web app?

查看:149
本文介绍了最好的位置把你的CSS和JS文件在一个Mavenized Java Web应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在maven中有一个符合以下结构的Web应用程序:

I have a Web application in maven that follows this structure:

src
`-- main
    |-- java
    |-- resources
    `-- webapp

最好是把它放在主文件夹中,然后maven插件将尝试移动它,或者我应该把它放在webapp文件夹中,为什么?

Is is better to put it in the main folder and then the maven plug in will try to move it or I should put it inside the webapp folder and why?

推荐答案

如果你不需要过滤CSS和JS文件,我会简单地把它们放在 src / main / webapp 他们在 src / main / resources 中,它们将在 target / classes WEB-INF / classes 在WAR中,这是不太可能是你想要的)。如果需要过滤它们,可以使用 webResources 参数在WAR中包含其他资源。请查看添加和过滤外部Web资源了解详情。

If you don't need to filter CSS and JS files, I would simply put them in src/main/webapp (if you put them in src/main/resources, they will end up in target/classes and in WEB-INF/classes in the WAR which is very unlikely what you want). If you need to filter them, additional resources can be included in the WAR using the webResources parameter. Have a look at Adding and Filtering External Web Resources for more details.

这篇关于最好的位置把你的CSS和JS文件在一个Mavenized Java Web应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆