加速Eclipse和JSF + Tomcat开发

时间:2022-09-13 20:03:25

Is there any way I can speed up the development of JSF in Eclipse and Tomcat?

有什么办法可以加快Eclipse和Tomcat中JSF的开发速度吗?

Basically I'm looking for a way to make the client-side changes (.jsf, .html, .css, .js) to happen a lot faster, and with out having to restart tomcat.

基本上我正在寻找一种方法来使客户端更改(.jsf,.html,.css,.js)更快地发生,并且不必重新启动tomcat。

And if possible, also a way to make tomcat (or any other Windows + Eclipse compatible Servlet Container), restart a lot faster.

如果可能的话,也是一种制作tomcat(或任何其他Windows + Eclipse兼容的Servlet容器)的方法,重启速度要快得多。

Because if I compare to my experience with ASP.NET/Visual Studio/IIS, it feels like I'm spending half the day waiting for Tomcat to restart, and sometimes I even get 404 in the browser, since it's not going fast enough.

因为如果我与我使用ASP.NET / Visual Studio / IIS的经验相比,感觉就像我花了半天等待Tomcat重启,有时我甚至在浏览器中获得404,因为它的速度不够快。

There MUST be some other way to be more productive, and still allow more test driven development.

必须有其他方法可以提高工作效率,并且仍然允许更多的测试驱动开发。

7 个解决方案

#1


A quick and dirty way to force Tomcat to recompile/reload your pages is to delete Tomcat's working directory. In my limited testing it works fine but obviously, I wouldn't recommend this in production. :)

强制Tomcat重新编译/重新加载页面的快速而肮脏的方法是删除Tomcat的工作目录。在我的有限测试中它工作正常,但显然,我不会在生产中推荐它。 :)

#2


Just in case you use Maven to build your project, you can use this command line to test in Tomcat:

如果您使用Maven构建项目,可以使用此命令行在Tomcat中进行测试:

mvn clean war:exploded tomcat:run

That will run a slim instance of Tomcat (tomcat:run) taking the changes of your web files (.jsp, .html, .css, .js) directly from the source you're editing (war:exploded), so you'll just hit F5 in your browser

这将运行一个苗条的Tomcat实例(tomcat:run)直接从您正在编辑的源(战争:爆炸)中更改您的Web文件(.jsp,.html,.css,.js),所以你'你只需在浏览器中点击F5即可

#3


I believe MyEclipse, if configured correctly, will let you update applications running in Tomcat without restarting Tomcat. It is unfortunately a commercial product though.

我相信MyEclipse,如果配置正确,将允许您更新在Tomcat中运行的应用程序,而无需重新启动Tomcat。不幸的是,它是一种商业产品。

Oracle JDeveloper had a copy of OC4J bundled and it was possible to make changes on-the-fly without restarting the container, again this may not be possible given your environment.

Oracle JDeveloper捆绑了OC4J的副本,可以在不重新启动容器的情况下即时进行更改,这可能无法在您的环境中实现。

#4


If I'm not mistaken you can just copy your client-side changes (.jsf, .html, .css, .js) to the webapps folder of your application, whilst it is running. The jboss J2EE version of Eclipse I'm using allows hot replacement of some java code.

如果我没弄错的话,您可以将客户端更改(.jsf,.html,.css,.js)复制到应用程序的webapps文件夹中,同时它正在运行。我正在使用的jboss J2EE版本允许热替换一些java代码。

#5


You can use some other container, not tomcat, which not needed to be restarted when you make some changes in you project. It's can be Jboss. Also If you will use some tools, for example JBoss Tools, you develop much faster and easy :-) As for me, when you make changes just in .css or .xhtml page, you shouldn't restart tomcat, you should just republish you application. In JBoss Tools you can make it using JBoss Tools server view.

您可以使用其他容器,而不是tomcat,当您在项目中进行一些更改时,不需要重新启动它。它可以是Jboss。另外如果你将使用一些工具,例如JBoss Tools,你开发得更快更容易:-)至于我,当你在.css或.xhtml页面中进行更改时,你不应该重启tomcat,你应该只是重新发布你申请。在JBoss Tools中,您可以使用JBoss Tools服务器视图进行创建。

#6


put this in your web.xml.

把它放在你的web.xml中。

<context-param>
    <param-name>facelets.REFRESH_PERIOD</param-name>
    <param-value>1</param-value>
</context-param>

This means : "how often will the app server recompile my JSP". The value is in seconds.

这意味着:“app服务器多久会重新编译我的JSP”。该值以秒为单位。

#7


You should use Dynamic Web Projects and tell Eclipse Java EE to deploy to a suitable Tomcat instance. This will allow Eclipse to help all it can (but that is still not blazing speed though).

您应该使用Dynamic Web Projects并告诉Eclipse Java EE部署到合适的Tomcat实例。这将允许Eclipse尽其所能(但这仍然不是超速)。

#1


A quick and dirty way to force Tomcat to recompile/reload your pages is to delete Tomcat's working directory. In my limited testing it works fine but obviously, I wouldn't recommend this in production. :)

强制Tomcat重新编译/重新加载页面的快速而肮脏的方法是删除Tomcat的工作目录。在我的有限测试中它工作正常,但显然,我不会在生产中推荐它。 :)

#2


Just in case you use Maven to build your project, you can use this command line to test in Tomcat:

如果您使用Maven构建项目,可以使用此命令行在Tomcat中进行测试:

mvn clean war:exploded tomcat:run

That will run a slim instance of Tomcat (tomcat:run) taking the changes of your web files (.jsp, .html, .css, .js) directly from the source you're editing (war:exploded), so you'll just hit F5 in your browser

这将运行一个苗条的Tomcat实例(tomcat:run)直接从您正在编辑的源(战争:爆炸)中更改您的Web文件(.jsp,.html,.css,.js),所以你'你只需在浏览器中点击F5即可

#3


I believe MyEclipse, if configured correctly, will let you update applications running in Tomcat without restarting Tomcat. It is unfortunately a commercial product though.

我相信MyEclipse,如果配置正确,将允许您更新在Tomcat中运行的应用程序,而无需重新启动Tomcat。不幸的是,它是一种商业产品。

Oracle JDeveloper had a copy of OC4J bundled and it was possible to make changes on-the-fly without restarting the container, again this may not be possible given your environment.

Oracle JDeveloper捆绑了OC4J的副本,可以在不重新启动容器的情况下即时进行更改,这可能无法在您的环境中实现。

#4


If I'm not mistaken you can just copy your client-side changes (.jsf, .html, .css, .js) to the webapps folder of your application, whilst it is running. The jboss J2EE version of Eclipse I'm using allows hot replacement of some java code.

如果我没弄错的话,您可以将客户端更改(.jsf,.html,.css,.js)复制到应用程序的webapps文件夹中,同时它正在运行。我正在使用的jboss J2EE版本允许热替换一些java代码。

#5


You can use some other container, not tomcat, which not needed to be restarted when you make some changes in you project. It's can be Jboss. Also If you will use some tools, for example JBoss Tools, you develop much faster and easy :-) As for me, when you make changes just in .css or .xhtml page, you shouldn't restart tomcat, you should just republish you application. In JBoss Tools you can make it using JBoss Tools server view.

您可以使用其他容器,而不是tomcat,当您在项目中进行一些更改时,不需要重新启动它。它可以是Jboss。另外如果你将使用一些工具,例如JBoss Tools,你开发得更快更容易:-)至于我,当你在.css或.xhtml页面中进行更改时,你不应该重启tomcat,你应该只是重新发布你申请。在JBoss Tools中,您可以使用JBoss Tools服务器视图进行创建。

#6


put this in your web.xml.

把它放在你的web.xml中。

<context-param>
    <param-name>facelets.REFRESH_PERIOD</param-name>
    <param-value>1</param-value>
</context-param>

This means : "how often will the app server recompile my JSP". The value is in seconds.

这意味着:“app服务器多久会重新编译我的JSP”。该值以秒为单位。

#7


You should use Dynamic Web Projects and tell Eclipse Java EE to deploy to a suitable Tomcat instance. This will allow Eclipse to help all it can (but that is still not blazing speed though).

您应该使用Dynamic Web Projects并告诉Eclipse Java EE部署到合适的Tomcat实例。这将允许Eclipse尽其所能(但这仍然不是超速)。