Maven模块用于静态文件 [英] Maven module for static files
问题描述
这将是我的应用程序的大纲:
- 应用程序
- 应用程序网络(java代码)
- 应用程序
- application-static(css,js and images)
- 应用程序资源(语言属性)
我想部署eclipse使用static模块的文件,而不是使用application / src / main / webapp目录。我该怎么做?这是可能的?
不要浪费你的时间开箱资源,一切都可以开箱即用:
- 资源束:始终从类路径加载,无论是分解(
WEB-INF / classes
)或压缩(WEB-INF / lib
) - 提供静态资源:将其捆绑在JAR中,并使用Tomcat (Servlet 3.0)功能从
META-INF / resources
提供,请参阅此处或使用Spring的内置mvc:resources
元素。
只需将相关性片段添加到WAR POM中即可完成。
I have a web application with spring and maven. The application is divided into maven modules. I have an "application-web" module that generates war. Another "application-ear" module that generates an ear. And another "application-static" with css, js and images that generates a zip file.
This would be the outline of my application:
- application
- application-web (java code)
- application-ear
- application-static (css, js and images)
- application-resources (language properties)
I want to deploy the eclipse use files of "static" module, instead of using the files in the "application/src/main/webapp" directory. How can I do this? It is possible?
Don't waste your time with unpacking resources, everything works out of the box:
- Resource bundles: the are always loaded from the classpath, regardlessly it is exploded (
WEB-INF/classes
) or compressed (WEB-INF/lib
) - Serving static resources: bundle them up in a JAR and use either Tomcat (Servlet 3.0) feature to serve from
META-INF/resources
, see here or use Spring's built inmvc:resources
element.
Simply add the dependency snippets in your WAR POM and your are done.
这篇关于Maven模块用于静态文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!