Eclipse 一直在运行我的旧 Web 应用程序
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/706140/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Eclipse keeps running my old web application
提问by Vidar
OMG - what is going on with Eclipse (3.3 Europa) - has anyone come accross this problem (bearing in mind I have been messing about with uninstalling different Tomat containers and installing others - but anyway thats another story)
OMG - Eclipse(3.3 Europa)发生了什么 - 有没有人遇到过这个问题(记住我一直在卸载不同的Tomat容器并安装其他容器 - 但无论如何那是另一个故事)
When I change a line of code or remove a class within my project - when I come to debug - it actually goes to a line that is commented out and runs that line regardless!!!! e.g.
当我在我的项目中更改一行代码或删除一个类时 - 当我开始调试时 - 它实际上会转到被注释掉的行并无论如何都运行该行!!!!例如
//System.out.println("you should not be able to read this!");
//System.out.println("你不应该读这个!");
UPDATE: This can be solved by setting Project -> Build Automatically (see answer below).
更新:这可以通过设置 Project -> Build Automatically 来解决(见下面的答案)。
REMAINING PROBLEM:
剩下的问题:
Eclipse is not keeping my hot deploy folder current with the latest changes to my project:
Eclipse 没有使我的热部署文件夹与我的项目的最新更改保持同步:
I found out to my horror that some old remenants of my project are 'hanging around' in the folder that I think Eclipse uses for hot deploys or something
我惊恐地发现我的项目的一些旧残留物在我认为 Eclipse 用于热部署或其他东西的文件夹中“徘徊”
C:\myJavaCode.metadata.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\myWebApp
C:\myJavaCode.metadata.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\myWebApp
basically it is not actually copying accross any changes made in the classes of my working dir!?!??
基本上它实际上并不是复制我的工作目录的类中所做的任何更改!?!??
...anyway - in order to keep my project up to date - I have to modify this folder too - TOTALLY UNACCEPTABLE - as you can't develop in this way - it would take you eons! Anyway, if anyone can help explain to me what stupid thing I have done to get me in this mess and how I can get out of this mess - I would really appreciate it.
...无论如何 - 为了让我的项目保持最新 - 我也必须修改这个文件夹 - 完全不可接受 - 因为你不能以这种方式开发 - 这会花费你很多时间!无论如何,如果有人能帮我解释一下我做了什么愚蠢的事情让我陷入困境以及我如何摆脱困境 - 我真的很感激。
采纳答案by Manrico Corazzi
Have a look at:
看一下:
Windows>Preferences>Server>Launching...
Windows>首选项>服务器>启动...
and:
和:
Project>Build Automatically
项目>自动构建
maybe you accidentally disabled the auto-deploy features.
也许您不小心禁用了自动部署功能。
回答by Dave
I had a similar problem, only without the added complexities of a web app. I'm just running a JUnit test and it's running the old code. I went into Configure Build Path, on the bottom of the Source tab, and looked at Default Output Folder, which said myproject/bin. The Package Explorer doesn't even show a bin folder, but when looking at the file system there's a bin folder there. I deleted the bin folder, refreshed the package explorer tree, and it worked. This behavior was in Helios and occurred with AND without Build Automatically selected...looks like a bug to me.
我有一个类似的问题,只是没有增加网络应用程序的复杂性。我只是在运行 JUnit 测试,它正在运行旧代码。我进入了“源”选项卡底部的“配置构建路径”,并查看了默认输出文件夹,其中显示了 myproject/bin。包资源管理器甚至没有显示 bin 文件夹,但是当查看文件系统时,那里有一个 bin 文件夹。我删除了 bin 文件夹,刷新了包资源管理器树,它起作用了。这种行为发生在 Helios 中,并且发生在 AND 没有自动选择 Build 的情况下......对我来说看起来像是一个错误。
Dave
戴夫
回答by sourcerebels
A super-silly question: Does all your webproject and related projects compile correctly?
一个超级愚蠢的问题:你所有的 webproject 和相关项目都编译正确吗?
Also check your output folder for classes (Project Properties -> Java Build Path -> Source Tab) then go to your filesystem and check permissions and modification dates.
还要检查您的输出文件夹中的类(项目属性 -> Java 构建路径 -> 源选项卡),然后转到您的文件系统并检查权限和修改日期。
Hope this will help you.
希望这会帮助你。
回答by sourcerebels
Probably the easiest way to get past this is to define a new server.
解决这个问题的最简单方法可能是定义一个新服务器。
Right-click in the Servers window and select New, or when you do 'Run On Server' select Manually define a new server. You can have multiple servers defined using the same Tomcat runtime (they'll all have separate configs and deployment directories defined by -Dcatalina.base=...), but don't run them at the same time unless you change the ports they're listening on.
在服务器窗口中右键单击并选择新建,或者当您执行“在服务器上运行”时选择手动定义新服务器。您可以使用相同的 Tomcat 运行时定义多个服务器(它们都有由 -Dcatalina.base=... 定义的单独配置和部署目录),但不要同时运行它们,除非您更改它们的端口正在听。
The new server will use a path like
新服务器将使用类似的路径
<<yourEclipseWorkspace>>\.metadata\.plugins\org.eclipse.wst.server.core\tmp1
for the Tomcat conf and webapps directory.
对于 Tomcat conf 和 webapps 目录。
Try running on this server. If it works, you can compare settings with the old one, maybe try deleting the app from it and re-deploying, and figure out what you might have done to cause the problem. Or just delete the original server config.
尝试在此服务器上运行。如果可行,您可以将设置与旧设置进行比较,也许尝试从中删除应用程序并重新部署,然后找出导致问题的原因。或者只是删除原始服务器配置。
As far as your second problem, I'm not sure. I'd try a new server config first, get it working, stop the server, do a 'Clean' on your project, delete anything in the tmp1\work\Catalina directory, and restart the server (you could remove and add your project to the server again too to be really clean).
至于你的第二个问题,我不确定。我会先尝试一个新的服务器配置,让它工作,停止服务器,对你的项目进行“清理”,删除 tmp1\work\Catalina 目录中的任何内容,然后重新启动服务器(你可以删除并添加你的项目再次到服务器也很干净)。
Check the console messages too to make sure there were no errors related to this.
也检查控制台消息以确保没有与此相关的错误。