Eclipse 发布到 Tomcat
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3978429/
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 publishing to Tomcat
提问by mkoryak
I recently came back to using Eclipse after 2 years of IntelliJ. Things have changed.
在使用 IntelliJ 2 年后,我最近又开始使用 Eclipse。事情变了。
Now when I try to run Tomcat, it tries to publishmy project to it. What the hell is publish?
现在,当我尝试运行 Tomcat 时,它会尝试将我的项目发布到它。发布是什么鬼?
What ever happened to pushing a war into the webapps directory and letting Tomcat deploy it?
将War推入 webapps 目录并让 Tomcat 部署它发生了什么?
Right now my deployment is broken because of compilation errors. I have a feeling that Eclipse is taking my project and copying it to webapps dir without first building it properly.
现在我的部署由于编译错误而中断。我有一种感觉,Eclipse 正在将我的项目复制到 webapps 目录,而没有先正确构建它。
Can someone explain to me what exactly publishing does, and also how to turn it off and use Tomcat like normal people?
有人可以向我解释发布究竟是做什么的,以及如何关闭它并像普通人一样使用 Tomcat?
采纳答案by Tomas Narros
A the "Servers" view, you can double click on your Tomcat instance, to open the server settings editor.
在“服务器”视图中,您可以双击您的 Tomcat 实例,打开服务器设置编辑器。
There, at the upper right corner, you can find the Publishingoptions. Check the "Never publish automatically" option, and save.
在那里,在右上角,您可以找到发布选项。选中“从不自动发布”选项,然后保存。
With this it should be enough.
有了这个应该就够了。
Oh, and by "Publishing", they kind of mean "Deploying", or "Copying to the deploy directory", depending on what server you are using.
哦,对于“发布”,它们的意思是“部署”或“复制到部署目录”,具体取决于您使用的服务器。
回答by Mike Pettigrew
Eclipse (Helios) makes a copy of your entire Tomcat configuration and starts a new instance of the Tomcat server when you are running the web application from Eclipse. That is why you must shut down any existing Tomcat service before running in Eclipse.
当您从 Eclipse 运行 Web 应用程序时,Eclipse (Helios) 会复制您的整个 Tomcat 配置并启动 Tomcat 服务器的新实例。这就是在 Eclipse 中运行之前必须关闭任何现有 Tomcat 服务的原因。
The application runs out of your workspace, not out of the "webapps" folder. Eclipse modifies the copied server.xml file to add "CONTEXT" tags that include your workspace project folders in the running application list.
应用程序用完您的工作区,而不是“webapps”文件夹。Eclipse 修改复制的 server.xml 文件以添加“CONTEXT”标记,这些标记包括正在运行的应用程序列表中的工作区项目文件夹。
The path in the "CONTEXT" tag should be the name of your project folder.
“CONTEXT”标签中的路径应该是您的项目文件夹的名称。
You can export the project to a WAR file and deploy your web application to the webapps folder if you want.
如果需要,您可以将项目导出到 WAR 文件并将您的 Web 应用程序部署到 webapps 文件夹。