10

Eclipse PDT 中的构建路径和包含路径有什么区别?

4

2 回答 2

7

Short answer: keep the list of source folders on both the same (as Eclipse will helpfully do for you by default).

Longer answer:

The easy/straightforward part: the include path settings in Eclipse PDT is the list of paths/projects/libraries that will be used as include path when launching your project (e.g. as PHP CLI app) from Eclipse.

The include path is also partially (see below) used for content assist (aka code completion). For example, if you have some external libraries or a linked project in your include path settings, you will have content assist, documentation popups, etc on functions and classes from these resources.

This is not completely true for items on the "source" tab of the include path. These are only considered for the runtime include path (when launching your app from eclipse) and content assist on include and require PHP statements.

For all the other handy stuff to work as well (content assist in normal PHP code, doc popups, clicking through, ...) you have to define these sources under the build path (as well).

As far as I understand, the build path is a "fork" of the source items of the include path in PDT 2.0 (see http://www.eclipse.org/pdt/release-notes/pdt2_0.php) as an optimization feature, to allow speeding up the build process.

So unless you are working on a complex/large project with build speed issues, it's probably the best/least confusing to keep the source items on build and include path the same.

于 2012-11-09T22:27:26.800 回答
4

构建路径是一组路径,IDE 将使用它来解析代码、显示错误、返回自动完成方法等......

包含路径是类似于 PHP 执行配置的包含路径的路径。

如果你有一个应该被执行的代码,但你不想在 IDE 中看到它,你可以只在包含路径中定义它。

当然,构建路径中定义的所有路径都会在执行/调试过程中自动添加到包含路径中,在这种情况下,构建路径将附加到包含路径中。

于 2009-10-06T19:19:07.760 回答