[英]Hot-deploy JSPs in web-fragment using Eclipse and Tomcat (Servlet 3.0)
I have a project set up like this: 我有一个像这样设置的项目:
/parent
/core
/src/main/
/resources/META-INF/
web-fragment.xml
/resources/jsp/
fragment.jsp
/java/
FragmentTest.java
/web
/src/main/
/webapp/
/WEB-INF/web.xml
/jsps/
parent.jsp
/java/
ParentTest.java
the 'core' compiles to a .jar within the .war. '核心'编译成.war中的.jar。
However, when deploying this to Tomcat, with debug enabled, I can edit parent.jsp and it will hot deploy, however if I update fragment.jsp then it will not, and I have to rebuild/redeploy/etc. 但是,在将此部署到Tomcat时,启用调试后,我可以编辑parent.jsp并进行热部署,但是如果我更新fragment.jsp则不会,而且我必须重建/重新部署/ etc。
However, any changes to the .java in either project will hot-deploy successfully. 但是,任一项目中对.java的任何更改都将成功进行热部署。
Is anyone aware of any configurations, etc. that may be missing to get web-fragment JSPs to hot deploy? 是否有人知道可能缺少任何配置等,以使Web片段JSP进行热部署?
Thanks! 谢谢!
I have the same situation. 我有同样的情况。 I have test-web (your parent ) and test-web-fragment (your core ).
我有test-web (你的父母 )和test-web-fragment (你的核心 )。 I resolved them in the following way:
我通过以下方式解决了这些问题:
In the /test-web -> Properties -> Deployment Assembly I added the Fileset rule that points to /test-web-fragment/src/main/resources/META-INF/resources (See the screenshots below). 在/ test-web - > Properties - > Deployment Assembly中,我添加了指向/ test-web-fragment / src / main / resources / META-INF / resources的Fileset规则(参见下面的屏幕截图)。
When I change something in a page from fragment, the eclipse builder copies it to /test-web/src/main/webapp . 当我从片段中更改页面中的某些内容时,eclipse构建器会将其复制到/ test-web / src / main / webapp 。 After that I do a right click to test-web in app server and click Full Publish and I have to the server my changes.
之后,我右键单击app-web in app server并单击Full Publish ,我必须在服务器上进行更改。 This trick I use in the development mode.
我在开发模式中使用的这个技巧。 When I make the build for production I use maven, without this rule.
当我为生产制作构建时,我使用maven,没有这个规则。
Your project structure confuses me a bit. 你的项目结构让我感到困惑。 We always place JSPs in
/src/main/webapp
and sub folders therein. 我们总是将JSP放在
/src/main/webapp
和子文件夹中。 I can very well imagine this to be the source of your problem. 我完全可以想象这是你问题的根源。
You will be able to hot deploy both JSPs and Java files if you do the following: 如果执行以下操作,您将能够热部署JSP和Java文件:
Separate your web fragment project into two different projects and reference them from your main Web applications: 将Web片段项目分成两个不同的项目,并从主Web应用程序中引用它们:
There could be a better option than this one, but at least you will be able to work properly until you find something better. 可能有比这更好的选择,但至少你能够正常工作,直到找到更好的东西。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.