Eclipse:清理、构建和发布之间的区别

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5656989/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 20:07:56  来源:igfitidea点击:

Eclipse: Difference between clean, build and publish

eclipsetomcatbuildpublish

提问by Maro

I am using eclipse with tomcat. On the server (right-click)tab you have the options: Clean, Publish and Clean Tomcat Work directory, What do these options really do and how are they different from project > Build

我正在使用 eclipse 和 tomcat。在服务器(右键单击)选项卡上,您有以下选项:清理、发布和清理 Tomcat 工作目录,这些选项究竟有什么作用,它们与项目 > 构建有何不同

回答by Ken Chan

When you run "project > Build", eclipse will compile all sources in folders on the build path to the .class files and put the .class files into the output folder you specified. Both of these folders can be configured from Project-> Properties-> Java Build Path. Note that eclipse has the incremental build feature that will only compile the sources that have changed since the last time the project is build.

当您运行时"project > Build",eclipse 会将构建路径上文件夹中的所有源代码编译为 .class 文件,并将 .class 文件放入您指定的输出文件夹中。这两个文件夹都可以从Project-> Properties-> Java Build Path. 请注意,eclipse 具有增量构建功能,该功能只会编译自上次构建项目以来发生更改的源代码。

If you enable Auto-build for the project ( via "Project-> Build Automatically") , the "project > Build"will run automatically when you add, remove, or modify the source files on the build path , so you don't have to call "project > Build" manually in this case.

如果为项目启用 Auto-build ( via "Project-> Build Automatically") ,"project > Build"当您添加、删除或修改构建路径上的源文件时,它将自动运行,因此在这种情况下您不必手动调用“项目 > 构建” .

The Publishoption in the server tab will deploy the application to your Tomcat instance by copying the project resources such as xml configuration files , web resource (html ,css, js etc) , and the compiled .class files you get from the "project > Build"to the correct location of the Tomcat instance .

Publish服务器选项卡选项将通过复制该项目的资源,如XML配置文件,网络资源(HTML,CSS,JS等)将应用程序部署到Tomcat实例,你从一开始编译的.class文件"project > Build"到正确的位置Tomcat 实例。

So , "Project > Build"is about compiling java sources to the .class files while the options in the server tab is about deploying the application to the tomcat instance and maintaining the tomcat instance .

因此,"Project > Build"是关于将 java 源代码编译为 .class 文件,而服务器选项卡中的选项是关于将应用程序部署到 tomcat 实例并维护 tomcat 实例。

You can find the information about the "server tab" (i.e. Web Tools Platform) from the following links: http://help.eclipse.org/helios/index.jsp?topic=/org.eclipse.wst.server.ui.doc.user/topics/tpublish.htmlhttp://wiki.eclipse.org/WTP_Tomcat_FAQ

您可以从以下链接中找到有关“服务器选项卡”(即 Web 工具平台)的信息: http://help.eclipse.org/helios/index.jsp?topic=/org.eclipse.wst.server.ui .doc.user/topics/tpublish.html http://wiki.eclipse.org/WTP_Tomcat_FAQ

回答by user3686535

Build: compile changed source files on the build path in the project
Clean: compile all source files on the build path in the project
Publish: Deploying the updated project in the web server instance

Build:在项目中的构建路径上编译更改的源文件
Clean:在项目中的构建路径上编译所有源文件
Publish:在 Web 服务器实例中部署更新的项目

回答by Francisco Alvarado

Clean, Publish and Clean Tomcat Work directory options work on server files, on the other hand Project>build work on workspace files (projects are inside workspace folder). Server files and workspace files are usually in separated folders, it depends on how do you have configured your server.

清理、发布和清理 Tomcat 工作目录选项适用于服务器文件,另一方面,项目>构建工作区文件(项目位于工作区文件夹内)。服务器文件和工作区文件通常位于单独的文件夹中,这取决于您如何配置服务器。