Bug 38235 - Variables should be allowed to contain other variables/lists
Summary: Variables should be allowed to contain other variables/lists
Status: VERIFIED INVALID
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.1   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: 3.0 M1   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-05-29 09:42 EDT by Alex Blewitt CLA
Modified: 2003-06-03 07:53 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alex Blewitt CLA 2003-05-29 09:42:01 EDT
It would be great if a variable could be defined that could represent a variable
or a list of variables. For example, I have JBoss installed and several other
libraries that are used by JBoss and my applications.

I'd like to be able to define
JBoss=/usr/local/jboss
JBoss_J2EE=${JBoss}/lib/j2ee.jar
JBoss_JMX=${JBoss}/lib/jmx.jar

and also
JBoss_ALL=${JBoss}/lib:${JBoss_J2EE}:${JBoss_JMX}

and then use JBoss_ALL in my projects.

I know that I can define the three variables seperately, but I use a lot of
projects where I'm using JBoss along with various other standard groupings
of Jar files. Ideally, I'd prefer not to have to set up each variable for
each project that I use, but instead set up a pseudo-variable that I use
for each project type (JBoss or J2ME) which then defines a related set of
project libraries.

Although bug 36960 describes the idea of a project template (which in itself
it would be very handy) it wouldn't capture any changes that were made to the
template to existing projects that had already been instantiated using the
project template.

Perhaps this could be considered for the 3.0 release along with the fix for 
bug 36960
Comment 1 Philipe Mulet CLA 2003-06-02 07:18:55 EDT
Are you talking about classpath variables ? The syntax you picked doesn't seem 
to refer to these.
Comment 2 Alex Blewitt CLA 2003-06-02 08:40:46 EDT
Oops. Yes, you are right -- I was referring to classpath variables.
Comment 3 Alex Blewitt CLA 2003-06-02 08:41:31 EDT
PS Was using syntax from a Bash-like shell to explain how I'd like to use
them, rather than necessarily that being the syntax they are used in Eclipse,
because of course at the moment variables cannot refer to other variables ...
Comment 4 Philipe Mulet CLA 2003-06-03 05:46:52 EDT
Variable entries can only denote one item. Classpath containers are rather to 
be used to abstract sets of libraries. However, there is no UI at the moment to 
handcraft your owns.
Comment 5 Alex Blewitt CLA 2003-06-03 06:07:05 EDT
Yes, I know -- that's why I raised this bug :-) 

However, allowing variables to refer to other variables would be a very neat
solution to this problem. You then already have the ability to represent these
nesting issues; in any case, the capability to 'extend' a variable is already
in the platform. All I'm suggesting is that a variable may be defined by
extending another variable, as opposed to a single classpath entry to be
an extended variable. That, in conjunction with defining a variable as a 'group'
of jars would solve this problem.

Note that there are several situations where this would be useful; J2EE with
Struts; MIDP 2.0 and Nokia extensions; J2EE with JSTL etc. Then you could
define a project to use a 'standard' set-up of the MIDP2_NOKIA rather than
having to remember to include each variable individually.
Comment 6 Philipe Mulet CLA 2003-06-03 06:42:23 EDT
And what about abstracting all these inside a project which exports its 
libraries ? Then you could construct all combinations you want.
Comment 7 Alex Blewitt CLA 2003-06-03 06:48:37 EDT
I'm not sure what you are referring to when you say 'these' -- can you rephrase
what you said? Thanks.
Comment 8 Philipe Mulet CLA 2003-06-03 06:59:11 EDT
You could abstract your set of libraries through a Java project which you can 
then require on other project's classpath. This library project simply needs to 
include these JARs on its build path and tag them as exported (to dependents).

You can define multiple of these library projects, and have them export each 
other if you need to achieve some nesting.

Also projects can be shared across source control...

So taking your example, I could imagine defining a Java project named "JBoss", 
and have it denote all the JARs you would refer through the variable JBoss_ALL.
It would export these libraries.

Then some project would simply prereq the JBoss project and that would be it.

One more advantage for this solution is that if at a later stage you want to 
have sources for JBoss or change its layout, then you would simply need to 
reorganize the JBoss project accordingly. Clients could be left unchanged, 
since they don't known about its internals.

You could also separate JBoss project into several smaller projects 
(JBoss_J2EE, JBoss_JMX) so as to achieve finer granularity of reuse.
Comment 9 Philipe Mulet CLA 2003-06-03 07:01:59 EDT
Also, using projects, you can better browse code into the proper context (JBoss 
implementation isn't mixed inside client code) and when defining working sets 
to scope search, projects are quite handy.
Comment 10 Philipe Mulet CLA 2003-06-03 07:02:53 EDT
For all these reasons, we went for a simple variable story, relying on the fact 
there was much more powerful ways to achieve more complex stories.
Comment 11 Alex Blewitt CLA 2003-06-03 07:07:37 EDT
I understand what you mean now :-) Yes, using a project as a placeholder
certainly does allow you to build the projects up in terms of a standard set
of libraries.

I also like the fact that this configuration is then stored in source control
as well.

If you mark this bug as 'invalid' then I'll verify it.
Comment 12 Philipe Mulet CLA 2003-06-03 07:51:53 EDT
Sounds good to me. Closing then.