Bug 39198 - [Contributions] Library Folder ClasspathContainer
Summary: [Contributions] Library Folder ClasspathContainer
Status: RESOLVED DUPLICATE of bug 50461
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.0   Edit
Hardware: All All
: P3 enhancement with 5 votes (vote)
Target Milestone: ---   Edit
Assignee: Jerome Lanneluc CLA
QA Contact:
URL:
Whiteboard:
Keywords: investigate
Depends on:
Blocks:
 
Reported: 2003-06-21 08:19 EDT by Joris Verschoor CLA
Modified: 2007-10-01 21:55 EDT (History)
6 users (show)

See Also:


Attachments
Sourcecode for the container (19.87 KB, application/zip)
2003-06-21 08:21 EDT, Joris Verschoor CLA
no flags Details
Sourcecode for the container (19.86 KB, application/zip)
2003-06-21 08:26 EDT, Joris Verschoor CLA
no flags Details
Sourcecode updated for use of folders outside of current project (19.86 KB, application/x-zip-compressed)
2003-10-19 04:47 EDT, Joris Verschoor CLA
no flags Details
Source (21.67 KB, application/x-zip-compressed)
2003-11-06 05:06 EST, Joris Verschoor CLA
no flags Details
Added support for external file system folders aswell (26.13 KB, application/zip)
2003-11-09 04:02 EST, Stuart McGrigor CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Joris Verschoor CLA 2003-06-21 08:19:48 EDT
This piece of code is a library folder classpath container. It adds all 
jars/zips in a folder (subfolders can be turned on or off) to te classpath

There are a few things left to do:
-short cut for browse
-refactor to another package
-the container only supports folders from the current project, I don't know if 
others would like to be able to choose folders from other projects, but I 
didn't.. But if anybody wants that, let me know
Comment 1 Joris Verschoor CLA 2003-06-21 08:21:23 EDT
Created attachment 5262 [details]
Sourcecode for the container

Someone should refactor the code to another package (org.eclipse.jdt / ui for
the pref page)
Comment 2 Joris Verschoor CLA 2003-06-21 08:26:58 EDT
Created attachment 5263 [details]
Sourcecode for the container
Comment 3 Wayne Parrott CLA 2003-09-25 17:26:22 EDT
I like this feature but would like to see it expanded to include library 
container management. In MyEclipse we have a concept known as a LibrarySet 
which is a user managed library container. We have not fully generalized the 
concept but it allow a user to add/remove Jars to the container and reorder the 
contents. The path of container elements can use classpath variables.
Comment 4 Martin Aeschlimann CLA 2003-10-07 15:16:43 EDT
I think we should add this to core and ui. Fredric, let's do it, I can integrate
the UI part.

Wayne, can you give more details about what you have in MyEclipse. How are these
LibrarySet's manages. On a preference page? Do you allow sharing in a team?

Would MyEclipse be interested to contribute that code?
Comment 5 Frederic Fusier CLA 2003-10-08 04:44:38 EDT
Joris,

We're actually interested with your proposal, but we still need to discuss how 
and where (perhaps not in jdt-core) we want to finalize this feature.

I let you inform of progress on this task.
Comment 6 Joris Verschoor CLA 2003-10-09 05:46:27 EDT
Ok Frédéric, thanks for letting me know. 
It's kind of frustrating submitting something many people like, and not hearing 
anything..

I'll upload the updated sourcecode today or tomorrow.

There was one thing I found while coding this thing:
I had to do a kind of hackery thing to set parameters to the library:

<classpathentry kind="con" 
path="com.insomniq.eclipse.jdt.LIB_CONTAINER/flat/projectname/docroot/WEB-
INF/lib"/>

I could not find anything about adding a new xml element..
What I'd like to see is something like:

<classpathentry kind="con" path="com.insomniq.eclipse.jdt.LIB_CONTAINER>
    <property name="recursive">false</property>
    <property name="libraryfolder">/projectname/docroot/WEB-INF/lib</property>
</classpathentry>

something like that, if anyone has any suggestions, let me know
Comment 7 Wayne Parrott CLA 2003-10-10 13:21:53 EDT
I was the developer of the MyEclipse libarySet concept, i.e., a user managed 
classpathContainer. In MyEclipse we needed a way for users to define a 
collection of jar/zips that could easily be added to a project's classpath. 
Specifically, we needed a way to bundle J2EE libraries that could be added to 
the classpath of MyEclipse J2EE projects as a single unit. Along the way we 
discovered that the concept could be generally useful. When we added the 
feature to automatically add files from the WEB-INF/lib folder to a project's 
classpath we started thinking about a generalization similar to Joris work 
(Joris very good idea). 

Presently, MyEclipse only supports 2 predefined librarySets 
(classpathContainers), 1 for J2EE 1.2 projects and 1 for J2EE 1.3 projects. 
Additionally, these libraries are available to add to any Java project's build 
path. This later capability led me to use 1 of the librarysets for hosting lots 
of common libraries that I'm always using and bundling for client projects. 
This allowed me to eliminate a common's project that I had maintained just 
hosting libs to be used by other projects (there is still a CVS issue to 
discuss). 

Here's how they work in MyEclipse. Since the librarySets are fixed at this time 
there are no Create/Delete functions for a librarySet. From a preference page a 
user is able to add, remove, and reorder the libs of a classpathContainer. 
The "Add Library" use-case allows the user to provide a relative path using 
Classpath Variables. For simplicity, a library is stored in the plugin's 
preference store. Also, from the Java project properties the librarysets are 
available as libraries to add to any Java project.

Recently, I was planning to extend the implementation to a much more 
generalized model but thought I would coordinate the effort with this group and 
see how our model matches up with Joris approach.

Wayne
Comment 8 Ralf Taugerbeck CLA 2003-10-17 06:28:03 EDT
IMO this feature would greatly improve multi platform development in Eclipse.
For example from time to time I need to switch my target platform (J2EE 1.2/1.3,
JBoss, WebSphere, Weblogic,...) or in more general the spec level of a set of
3rdparty libs.
I like Joris approach but it is a bit to coarse grained yet. And please don't
forget to allow source and api doc attachments for library set entries as it is
possible when defining JRE system libraries.
BTW a colleague of mine uses Fake JRE system libraries to define his library
sets. This is kind of misuse but it works ;-) 
Comment 9 Joris Verschoor CLA 2003-10-17 10:49:33 EDT
What I see are two different containers:

1) My approach, which adds a folder's jars, no apidocs / source whatever, and 
project specific

2) The LibrarySet approach, which is handy for common used jars. For J2EE and 
frameworks like struts/jsf/hibernate, which are shared between projects.

I haven't thought about the apidocs / sourcelocations yet, but that's important 
too.

I think these two features should be implemented seperately. The only thing 
they share is that they are ClasspathContainers.

Comment 10 Joris Verschoor CLA 2003-10-19 04:47:09 EDT
Created attachment 6476 [details]
Sourcecode updated for use of folders outside of current project

This version will allow folders of other projects to be used as containers.
Comment 11 Stuart McGrigor CLA 2003-11-04 01:32:42 EST
I tried the attachment today;  It is still only allowing library folders that 
are part of the project.

I checked the source code in the attachement for 2003-10-19, it is unchanged 
from the attachment for 2003-06-21.  The .class files are dated 2003-06-21  but 
the .java files are dated 2003-06-??

It seems Joris' finger slipped in his enthusiasm.
Comment 12 Joris Verschoor CLA 2003-11-06 05:06:03 EST
Created attachment 6676 [details]
Source

I've had a harddisk crash, and I thought I had the latest source at home. This
should be the most recent version. date/time also matches..
Comment 13 Stuart McGrigor CLA 2003-11-09 04:02:34 EST
Created attachment 6708 [details]
Added support for external file system folders aswell

- Added support for external file system folders
- Fixed copy 'n paste errors in folder selection dialogs.
Comment 14 Aaron Digulla CLA 2004-01-06 05:18:32 EST
Here are some additional ideas for the containers.

Currently, there is a severe problem when you share projects between different 
OSs, like Linux and Windows, when the JARs between these systems differ (like 
when you use SWT or JAI).

Proposed solution: The container should be stored in an external file, 
preferrably in ANT-compatible syntax, so the very same file can be used in ant.

These options should contain the following information:

- A name for the container (users should be able to select it by this name in 
the UI and in ANT).
- A set of JARs. It should be possible to use variables in the paths to these 
JARs and paths relative to the project/workspace. For each JAR, there should be 
an option to set the path to the source and to the JavaDoc.
- A set of Java VM options to use when a program is run which uses this 
container (especially extensions to java.library.path!)

As for the switch between the OSs, I see these solutions:

1. One can include all containers for each OS in the project. Users will then 
have to copy those they need to a place where eclipse will look for them. More 
simple to implement but confusing, especially when the container in the project 
changes and users forget to update their copy.

2. The OS for which this container is valid is specified in the file. Eclipse 
only considers containers for the OS on which it runs.

3. A container could be split into "common" and "OS specific" parts. This 
leaves the question how to handle different OS versions. There might be 
containers which contain different files for Win95 and Win2000.

The goal of this enhancement should be to allow to create projects which 
compile with little or no user changes on different OSs. It should especially 
be possible to commit the .classpath and .project files to a shared repository.

If the format of this extenal file would be compatible with ANT (using 
<classpath> elements), then these could be shared between Eclipse and ANT, 
solving the many requests to be able to share the classpath between ANT and 
Eclipse.
Comment 15 Aaron Digulla CLA 2004-01-06 07:07:51 EST
The project "User Libraries" on http://www.javango.net/eclipse/userlib.html 
implements part of the functionality which I proposed.

JBuilder can do something similar. There, you can define libraries on the level 
of the system (all projects on this host), user (searches $HOME) and the 
project (in the projects' files)
Comment 16 Martin Aeschlimann CLA 2004-03-06 19:35:55 EST
added user libraries as described in bug 50461, comment 3.
> 20040307

Currently all in jdt.ui. It is planed to move the classpath container
infrastructure down to jdt.core

*** This bug has been marked as a duplicate of 50461 ***
Comment 17 Stephen Schaub CLA 2007-06-27 13:21:51 EDT
This bug is marked resolved, but the original feature requested (adding all jars in a folder to the classpath) is still not addressed as of Eclipse 3.3. See bug 166556 for a new RFE requesting this feature.
Comment 18 Tadashi Murakami CLA 2007-10-01 21:55:56 EDT
bug 39198, bug 50461, bug 166556

I published a new version of 'Library Folder ClasspathContainer'
with an agreement with the original author, Joris.
Library Folder ClasspathContainer marks a folder and adds all
jars and zips on the folder.
When a member of the jars or zips is removed, this plugin automatically
follows the changes.
I modified the original plugin for eclipse 3.2 and 3.3. Maybe available on 3.0 and 3.1.

Please visit and try it.
  http://libcontainer.sourceforge.net/updates/