A Java project in Eclipse keeps its build path in a .classpath file beside
.project. It is XML with a classpath root holding
classpathentry elements. This page is taken from the Eclipse JDT code
that reads and writes it.
Entries
| Element | Meaning |
|---|---|
classpath | The root. |
classpathentry | One build path entry; attributes below. |
referencedentry | An entry referenced by another, stored separately from the raw classpath. |
attributes / attribute | Inside an entry: extra settings, each with name and value (below). |
accessrules / accessrule | Inside an entry: access rules (below). |
Kinds
kind | Entry |
|---|---|
src | A source folder, or (for backward compatibility) another project: a src entry whose path is a single segment other than this project’s name is read as a project reference. |
lib | A library: a JAR or class folder. |
var | A library reached through a classpath variable. |
con | A classpath container, such as the JRE. |
output | The default output folder. |
prj | Read as a project entry, but not written. |
Entry attributes
| Attribute | Meaning |
|---|---|
kind | The kind (above); read without regard to case. |
path | The entry’s path. |
sourcepath | Source attachment for a library. |
rootpath | Root path within the source attachment. |
output | A source folder’s own output folder. |
exported | true: the entry is exported to projects that depend on this one. |
including, excluding | Inclusion and exclusion patterns, joined by |. |
combineaccessrules | On a project entry: false when the other project’s access rules are not combined with these (written only then). |
Access rules
| Attribute | Meaning |
|---|---|
pattern | A path pattern for the types it covers. |
kind | accessible, nonaccessible (forbidden references) or discouraged (discouraged references). |
ignoreifbetter | true: ignore this rule if a better one applies. |
Classpath attributes
| Name | Meaning |
|---|---|
javadoc_location | URL of the entry’s Javadoc. |
index_location | URL of a pre-built index file. |
source_encoding | Character encoding of the source attachment. |
ignore_optional_problems | true: suppress optional compiler problems in this source folder. |
optional | true: ignore the entry quietly if it is missing. |
module | true: put the entry on the module path. |
add-exports | Extra package exports at compile time (--add-exports syntax). |
add-opens | Extra package opens at launch (--add-opens). |
add-reads | An extra module read edge (--add-reads). |
patch-module | Compile sources into a named module (--patch-module). |
limit-modules | Limit the observable modules. |
module-main-class | Main class recorded in module-info.class. |
annotationpath | Folder of external annotations for null analysis. |
test | true: the source folder holds tests. |
without_test_code | true: the referenced project’s test code stays invisible. |
release | A Java release above 8 for multi-release compilation of a source folder. |
Sources
Eclipse JDT Core source: ClasspathEntry.java (element and attribute
names, kind strings, project entries, access rule kinds) and
IClasspathAttribute.java (attribute names and meanings). The short
meanings of the kinds, of sourcepath, rootpath,
referencedentry and ignoreifbetter are read from the names
in that code and are unconfirmed by a written specification. Container IDs
(such as the JRE container’s) and variable names are defined by plugins and are not
listed.