简体   繁体   English

如何使用Maven正确管理Web应用程序的站点?

[英]How to manage sites of a web app with Maven properly?

For my web application I am using the Maven Standard Directory Layout. 对于我的Web应用程序,我正在使用Maven标准目录布局。 With the exception of the place of my sites (I am talking about template files here, *.ftl, *.xslt, etc.). 除了我的网站位置(我在这里谈论模板文件,*。ftl,*。xslt等)。

Instead under src/main/webapp they are at site/ftl 而是在src / main / webapp下,它们位于site / ftl

The reason is I develop my application within Eclipse which has it's root directory set to the project folder. 原因是我在Eclipse中开发了应用程序,该应用程序的根目录设置为项目文件夹。 Therefore all files I define will be accessed from the project root directory. 因此,可以从项目根目录访问我定义的所有文件。

I thought it would be wrong to give a file path which points into a source folder to code which is not actually compiled. 我认为将指向源文件夹的文件路径指定为实际上未编译的代码是错误的。

What's the standard approach here? 这里的标准方法是什么? I don't use WAR deployment for Tomcat, but Jetty as integrated web server. 我不将WAR部署用于Tomcat,但将Jetty用作集成的Web服务器。

As far as I know from java and scala maven projects, the standard place for template files is src/main/webapp/templates or somewhere inside src/main/resources . 据我从java和scala maven项目了解,模板文件的标准位置是src / main / webapp / templatessrc / main / resources内的某个位置。

As mentioned in Introduction to the Standard Directory Layout , the src/main/webapp is for web application sources. 标准目录布局简介中所述src / main / webapp用于Web应用程序源。 And those sources are commonly should not be compiled, because they are already ready to be executed by the browser. 而且通常不应该编译那些源代码,因为它们已经准备好由浏览器执行。

Web application sources are different from java sources, for instance, as former are executed by the browser without compilation, and latter should be compiled before execution by java plugin. Web应用程序源与Java源程序不同,例如,前者是由浏览器执行而无需编译,而后者应在由Java插件执行之前进行编译。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM