Eclipse 中java build path面板的功能梳理

来源:互联网 发布:产业链大数据分析系统 编辑:程序博客网 时间:2024/05/29 14:05


简易版:

Source标签页,指定本工程的源码目录和输出目录。
Projects标签页,指定本工程所依赖的其他工程。
Libraries标签页,指定本工程所需的jar包和class目录等。
Order And Export标签页,指定本工程的编译引用顺序和导出内容等。

官方版:

Java Build Path

The options in this page indicate the build path settings for a Java project. You can reach this page through the project properties (Project > Properties > Java Build Path) from the context menu on a created project or the File menu of the workbench.

The build class path is a list of paths visible to the compiler when building the project.

Source tab

Source folders are top-level folders in the project hierarchy. They are the root of packages containing .java files. The compiler will translate the contained files to .class files that will be written to the output folder.

Source folders allow to structure the project, for example to separate test from the application in two source folders. Within a source folder, a more detailed structuring can be achieved by using packages.

Each source folder can define an exclusion filter to specify which resources inside the folder should not be visible to the compiler.

Resources existing in source folders are copied to the output folder unless the setting in the Java > Compiler > Building preference page specifies that the resource is filtered. The output folder is defined per project except if a source folder specifies its own output folder.

Source folder options:
OptionDescriptionAdd FolderCreates a new folder to contain sourceLink SourceCreates a new folder that links to an location outside of the workspaceEditAllows to modify the currently selected source folder or source folder attribute.RemoveRemoves the selected folders from the class path. This does not delete the folders nor their contents.Allow output folder per source folderShows/Hides the 'output folder' attribute of the source folders
Source folder attributes:
AttributeDescriptionExclusion filterSelects which resources are not visible to the compiler. For details seeInclusion and exclusion patterns.Output folderOnly available when Allow output folder per source folder is checked. Defines a source folder specific output location. If not set the project's default output folder is used.Native library locationDefines the folder that contains the native libraries (for example 'dll' or 'o' files) required at runtime by the sources in the source folder.

At the bottom of this page, the Default output folder field allows you to enter a path to a folder path where the compilation output for this project will reside. The default output is used for source folders that do not specify an own output folder. Use Browse to select an existing location from the current project.

Projects tab

In the Required projects on the build path list, you can add project dependencies by selecting other workbench projects to add to the build path for this new project.

Adding a required project indirectly adds all its classpath entries marked as 'exported'. Setting a classpath entry as exported is done in the Order and Export tab.

The projects selected here are automatically added to the referenced projects list. The referenced project list is used to determine the build order. A project is always build after all its referenced projects are built.

ActionDescriptionAddAdd another project in the workspace to the build path of this project.EditEdit the classpath attribute of a required project.RemoveRemoves the selected required projects from the list.Project entry attributes:
AttributeDescriptionNative library locationSpecifies where native library required for the project to operate can be found.Access rulesSpecifies access rules for project contained in the library. This allows to hide content of a project.

Libraries tab

On this page, you can add libraries to the build path.

By default, the library list contains an entry representing the Java runtime library. This entry points to the JRE selected as the default JRE. The default JRE is configured in the Java > Debug > Installed JREs preferences page.

Libraries tab options:
OptionDescriptionAdd JARsAllows you to navigate the workbench hierarchy and select JAR files to add to the build path.Add External JARsAllows you to navigate the file system (outside the workbench) and select JAR files to add to the build path.Add VariableAllows you to add classpath variables to the build path. Classpath variables are an indirection to JARs with the benefit of avoiding local file system paths in a classpath. This is needed when projects are shared in a team.
Variables can be created and edited in the Java > Build Path > Classpath Variables preference page.Add LibraryAllows to add a predefined libraries like the JRE System Library. Such libraries can stand for an arbitrary number of entries (visible as children node of the library node)Add Class FolderAllows to navigate the workbench hierarchy and select a class folder for the build path. The selection dialog also allows you to create a new folder.Add External Class FolderAllows to navigate the file system (outside the workbench) and select a class folder for the build path. The selection dialog also allows you to create a new folder.EditAllows you to modify the currently selected library entry or entry attributeRemoveRemoves the selected element from the build path. This does not delete the resource.Migrate JAR FileMigrate a JAR on the build path to a newer version. If the newer version contains refactoring scripts the refactoring stored in the script will be executed.

 Libraries have the following attributes (presented as library entry children nodes):

Library entry attributes:
AttributeDescriptionSource attachmentSpecifies where the library's source can be found.Javadoc locationSpecifies where the library's Javadoc documentation can be found. If specified you can use Shift+F2 on an element of this library to open its documentation.External annotationsSpecifies where external annotations for the library can be found. If specified these annotations will be considered by JDT for its static null analysis.Native library locationSpecifies where native library required for the library to operate can be found.Access rulesSpecifies access rules for resources contained in the library. This allows to hide content of a library.

Order and Export tab

In the Build class path order list, you can click the Up and Down buttons to move the selected path entry up or down in the build path order for this new project.

Checked list entries are marked as exported. Exported entries are visible to projects that require the project. Use the Select All and Deselect All to change the checked state of all entries. Source folders are always exported, and can not be deselected.


参考:

1.http://blog.csdn.net/gaojinshan/article/details/21094145

2.http://help.eclipse.org/mars/index.jsp?topic=%2Forg.eclipse.jdt.doc.user%2Freference%2Fref-properties-build-path.htm

0 0
原创粉丝点击