Interpreting eclipse .classpath file. What does 'kind="con"' and 'exported="true"' mean?
Asked Answered
F

2

37

This is the eclipse .classpath file of the eclipse plugin program that I downloaded.

I think that kind="src" and kind="output" is pretty straight forward, as they means the where the source java files and compiled class files are located.

The kind="lib" seems to indicate the jar files the plugin is referencing, but I have something that I'm not sure about.

  • What does the kind="con" mean?
  • What is it for the exported="true"? I think in order to use this plugin, all the jar files that the plugin refers to should be exported, but only some of them are exported.

enter image description here

Ferment answered 19/12, 2012 at 20:22 Comment(0)
D
28

1) In kind="con", the con stands for container, which is interpreted by eclipse as a classpath container. As described in that link:

A classpath container provides a way to indirectly reference a set of classpath entries through a classpath entry of kind CPE_CONTAINER

In other words, it enables grouping of other classpath entries in any way and re-use it wherever (including the ability of having different entries for different projects).

2) exported: Say you have Project B that depends on Project C. The dependency is defined as exported=true. Then, another Project A that depends on Project B, will have also Project C present on A'a classpath.

Dane answered 19/12, 2012 at 20:53 Comment(5)
Then, I guess the exported libraries are only for runtime purposes. I mean, when the libraries are not referenced at runtime, you don't have to export it.Ferment
@Ferment well, just like any class file... However, if you want to use the library in the code of your A project, you need it also at compile time, but that happens usually when all project A, B and C are all yours and not some 3rd party.Dane
@Ferment when B is a 3rd party, it typically exports its dependencies when the dependecy is not guaranteed to be present at the classpath of the client code that uses the 3rd party. If the use you make of that 3rd party doesn't actually require a particular dependncy it exports - it may be excluded.Dane
@yair: So in your example: the exported-attribute belongs to the classpath of project B and there it says that project C will be exported for other projects that import project B (for example for project A). Only when I export the dependency to C in B, someone is able to see C in ALikely
@Likely after reading the answer and your comment - yes, I think you got it right (but it has been some 6+ years since posting this answer... :) ).Dane
F
7
  • kind="con" are indicating classpath containers
  • exported=true exports the dependency, meaning that any project that has a depedency on your project can see/access the exported dependencies as well.
Fleischman answered 19/12, 2012 at 20:42 Comment(1)
Broken Link "classpath containers"Hannover

© 2022 - 2024 — McMap. All rights reserved.