[英]Deploy only java file without deploying the WAR
I have a jsp based web application. 我有一个基于jsp的Web应用程序。
The source is kept in C:/MyApp/src
. 源代码保存在
C:/MyApp/src
。 Here it contains the controllers and other .java
files. 这里包含控制器和其他
.java
文件。
After building the application via eclipse. 通过Eclipse构建应用程序之后。 I copied the
.war
file to Apache/WebApps
folder. 我将
.war
文件复制到Apache/WebApps
文件夹。 Apache Tomcat expanded it and the web-application is working perfectly. Apache Tomcat对其进行了扩展,并且该Web应用程序运行正常。
From the last couple of days I edited a lot of pages directly in Apache/WebApps
folder. 从最近几天开始,我直接在
Apache/WebApps
文件夹中编辑了许多页面。 Now I want to edit a .java
file in C:/MyApp/src/..
现在,我想在
C:/MyApp/src/..
编辑一个.java
文件C:/MyApp/src/..
Now I want to use that updated .java
file in my Apache/WebApps
but don't want to rebuild the whole code via eclipse. 现在,我想在我的
Apache/WebApps
使用该更新的.java
文件,但不想通过eclipse重建整个代码。 If I do so my changes that I made in Apache/WebApps
folder will be lost. 如果这样做,我在
Apache/WebApps
文件夹中所做的更改将丢失。
What should I do? 我该怎么办?
you should 你应该
Follow the changes as suggested by @bpgergo or else ... 按照@bpgergo的建议进行更改,否则...
You can configure your tomcat server with Eclipse and are starting and stopping the server from eclipse then you can add your project
to the configured Server in eclipse. 您可以使用Eclipse配置tomcat服务器,并从eclipse启动和停止服务器,然后可以在eclipse
add your project
到已配置的Server。
Eclipse can be configured to auto-deploy the changes to the server, so whenever you change anything like a JSP or a java file the server will automatically take the changes without you deploying your WAR file. 可以将Eclipse配置为自动将更改部署到服务器,因此,无论何时更改JSP或Java文件之类的内容,服务器都将自动进行更改,而无需部署WAR文件。
But since java changes are not hot-deployable eclipse would restart the server whenever you save changes to your java file. 但是由于Java更改不是可热部署的,因此每当您将更改保存到Java文件时,Eclipse都会重新启动服务器。
If you want to deploy java changes without restarting the server you can also try using JRebel (it is free for 30 days :-)). 如果要在不重新启动服务器的情况下部署Java更改,也可以尝试使用JRebel (30天免费:-)。
For now I would suggest (if you don't want to go the above mentioned way. The following is a very crude method and should be avoided in the future) 现在,我建议 (如果您不想采用上述方式。以下是非常粗略的方法,将来应避免使用)
.java
file into a .class
in eclipse. .java
文件编译成.class
。 .class
file to the exact location on the server in WEB-INF/classes/..
.class
文件复制到WEB-INF/classes/..
服务器上的确切位置WEB-INF/classes/..
.java
changes .java
更改 Hope this helps. 希望这可以帮助。
Install the Plugin 安装插件
http://andrei.gmxhome.de/filesync/index.html
And work with extracted war-files. 并处理提取的战争文件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.