Skip to main content



      Home
Home » Newcomers » Newcomers » Project local classpath
Project local classpath [message #247654] Mon, 04 February 2008 12:30 Go to next message
Eclipse UserFriend
Hi,

I'm trying to set up a classpath for several versions of the same project.

I have tried using classpath variables, but these seem to by global rather
than per project.

The problem I have is that I might have several versions of the same
project mounted on different drives (actually clearcase views) so I want
to be able to set the classpath differently for each version of the same
project. Other users may also be using versions of the project, but
mounted on different drives.

I'd like the classpath file to be under source control and so common to
all versions of the project, but not have it tied to a particular mount
point.

I'd also like to be able to have different versions of the project mounted
on different mount points. So a single classpath variable would not work
across all versions of the project.

Can anyone help?

Thanks
Re: Project local classpath [message #247799 is a reply to message #247654] Mon, 04 February 2008 17:08 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: wegener.cboenospam.com

Keep each version in a separate workspace. You can then set the classpath
variables based on the workspace.
"Andy Ling" <andy.ling@quantel.com> wrote in message
news:977cabe3c404cf9f4653dca5e62e3d26$1@www.eclipse.org...
> Hi,
>
> I'm trying to set up a classpath for several versions of the same project.
>
> I have tried using classpath variables, but these seem to by global rather
> than per project.
>
> The problem I have is that I might have several versions of the same
> project mounted on different drives (actually clearcase views) so I want
> to be able to set the classpath differently for each version of the same
> project. Other users may also be using versions of the project, but
> mounted on different drives.
>
> I'd like the classpath file to be under source control and so common to
> all versions of the project, but not have it tied to a particular mount
> point.
>
> I'd also like to be able to have different versions of the project mounted
> on different mount points. So a single classpath variable would not work
> across all versions of the project.
>
> Can anyone help?
>
> Thanks
>
Re: Project local classpath [message #247863 is a reply to message #247799] Tue, 05 February 2008 04:35 Go to previous messageGo to next message
Eclipse UserFriend
Dave Wegener wrote:

> Keep each version in a separate workspace. You can then set the classpath
> variables based on the workspace.

I don't see that as a practical solution. That means you have to restart
eclipse every time you want to change project and there is no way to share
or compare things between project.

Is that really the only way?
Re: Project local classpath [message #247903 is a reply to message #247654] Tue, 05 February 2008 09:12 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: eclipse-news.rizzoweb.com

Andy Ling wrote:

> Hi,

> I'm trying to set up a classpath for several versions of the same project.

> I have tried using classpath variables, but these seem to by global rather
> than per project.

> The problem I have is that I might have several versions of the same
> project mounted on different drives (actually clearcase views) so I want
> to be able to set the classpath differently for each version of the same
> project. Other users may also be using versions of the project, but
> mounted on different drives.

> I'd like the classpath file to be under source control and so common to
> all versions of the project, but not have it tied to a particular mount
> point.

> I'd also like to be able to have different versions of the project mounted
> on different mount points. So a single classpath variable would not work
> across all versions of the project.

It's not clear to me why the classpath has to change just because the
project's location on the file system is different. What is in the
classpath that depends on the project's location?

Eric
Re: Project local classpath [message #247912 is a reply to message #247863] Tue, 05 February 2008 09:17 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: wegener.cboenospam.com

You can multiple projects in the same workspace. A given workspace should
only have one version of any project.

"Andy Ling" <andy.ling@quantel.com> wrote in message
news:089a95687b018b67a3b384e52f7757c3$1@www.eclipse.org...
> Dave Wegener wrote:
>
> > Keep each version in a separate workspace. You can then set the
classpath
> > variables based on the workspace.
>
> I don't see that as a practical solution. That means you have to restart
> eclipse every time you want to change project and there is no way to share
> or compare things between project.
>
> Is that really the only way?
>
>
>
Re: Project local classpath [message #247921 is a reply to message #247903] Tue, 05 February 2008 11:24 Go to previous messageGo to next message
Eclipse UserFriend
Eric Rizzo wrote:

> It's not clear to me why the classpath has to change just because the
> project's location on the file system is different. What is in the
> classpath that depends on the project's location?

The project points to a directory tree that is under clearcase source
control. This includes jars that are used during the build process.

This directory tree can get mounted as a different mount point depending
on which clearcase view is used. So the path to the jars can change.

Several versions of the same project exist. Different bugfix branches etc.
It
is useful to have these available in the same eclipse workspace, but it is
not
possible to have the classpath work for each version of the project as
they have different mount points.
Re: Project local classpath [message #247926 is a reply to message #247912] Tue, 05 February 2008 11:26 Go to previous messageGo to next message
Eclipse UserFriend
Dave Wegener wrote:

> You can multiple projects in the same workspace. A given workspace should
> only have one version of any project.

Why? It works fine for projects that don't need to change
the classpath. We've been doing that for ages.
Re: Project local classpath [message #247937 is a reply to message #247921] Tue, 05 February 2008 11:44 Go to previous messageGo to next message
Eclipse UserFriend
Andy Ling wrote:

> Eric Rizzo wrote:

>> It's not clear to me why the classpath has to change just because the
>> project's location on the file system is different. What is in the
>> classpath that depends on the project's location?

> The project points to a directory tree that is under clearcase source
> control. This includes jars that are used during the build process.

> This directory tree can get mounted as a different mount point depending
> on which clearcase view is used. So the path to the jars can change.

> Several versions of the same project exist. Different bugfix branches etc.
> It
> is useful to have these available in the same eclipse workspace, but it is
> not
> possible to have the classpath work for each version of the project as
> they have different mount points.

Actually this is a problem for different projects also. As an example :-

If we have two projects that use tomcat. The tomcat libraries are kept
under source control so we would have a directory structure that looks
something like e.g.

/tomcat/....
/project1/...
/project2/...

when these get mounted as part of a clearcase view you get a structure
that looks like

/view1/tomcat/...
/view1/project1/..
etc.

and a different view for the second project might look like

/view2/tomcat/....
/view2/project2/....

So the path to the tomcat libraries is different in each case.

It is useful and convenient to have both these projects available
in the same eclipse workspace, but it is not possible to make the classpath
work for both.
Re: Project local classpath [message #247970 is a reply to message #247937] Tue, 05 February 2008 14:38 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: wegener.cboenospam.com

"Andy Ling" <andy.ling@quantel.com> wrote in message
news:9b95e357d83d2496ff7832bca058f5a0$1@www.eclipse.org...
> Andy Ling wrote:
>
> > Eric Rizzo wrote:
>
> >> It's not clear to me why the classpath has to change just because the
> >> project's location on the file system is different. What is in the
> >> classpath that depends on the project's location?
>
> > The project points to a directory tree that is under clearcase source
> > control. This includes jars that are used during the build process.
>
> > This directory tree can get mounted as a different mount point depending
> > on which clearcase view is used. So the path to the jars can change.
>
> > Several versions of the same project exist. Different bugfix branches
etc.
> > It
> > is useful to have these available in the same eclipse workspace, but it
is
> > not
> > possible to have the classpath work for each version of the project as
> > they have different mount points.
>
> Actually this is a problem for different projects also. As an example :-
>
> If we have two projects that use tomcat. The tomcat libraries are kept
> under source control so we would have a directory structure that looks
> something like e.g.
>
> /tomcat/....
> /project1/...
> /project2/...
>
> when these get mounted as part of a clearcase view you get a structure
> that looks like
>
> /view1/tomcat/...
> /view1/project1/..
> etc.
>
> and a different view for the second project might look like
>
> /view2/tomcat/....
> /view2/project2/....
>
> So the path to the tomcat libraries is different in each case.
>
> It is useful and convenient to have both these projects available
> in the same eclipse workspace, but it is not possible to make the
classpath
> work for both.
>
You can define either a classpath variable or a linked resource to represent
the root of the filesystem. You then set the variable in the workspace to
point to view1 or view2. Since the variable is shared between all projects
in a workspace, you would only be able to see one version at a time. This
is why you need to have different versions in different workspaces.
>
Re: Project local classpath [message #248037 is a reply to message #247970] Wed, 06 February 2008 06:03 Go to previous messageGo to next message
Eclipse UserFriend
Dave Wegener wrote:


> You can define either a classpath variable or a linked resource to represent
> the root of the filesystem. You then set the variable in the workspace to
> point to view1 or view2. Since the variable is shared between all projects
> in a workspace, you would only be able to see one version at a time. This
> is why you need to have different versions in different workspaces.
>>

This is the trouble. What I have described is two different projects
that are in the same workspace. They both use the "tomcat" resource, but it
is mounted under a different root. So I need a different classpath for
each project. Classpath variables would work if they could be set
differently for each project. As they can't it looks like I can't
do what I want. Unless I'm missing something.

Having them in different workspaces is a pain. It means restarting eclipse
to switch and sharing or comparing between projects becomes difficult.

What do you mean by "linked resource"? Would that give me what I want?

Thanks for your help
Re: Project local classpath [message #248068 is a reply to message #247937] Wed, 06 February 2008 09:44 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: eclipse-news.rizzoweb.com

Andy Ling wrote:
> Andy Ling wrote:
>
>> Eric Rizzo wrote:
>
>>> It's not clear to me why the classpath has to change just because the
>>> project's location on the file system is different. What is in the
>>> classpath that depends on the project's location?
>
>> The project points to a directory tree that is under clearcase source
>> control. This includes jars that are used during the build process.
>
>> This directory tree can get mounted as a different mount point depending
>> on which clearcase view is used. So the path to the jars can change.
>
>> Several versions of the same project exist. Different bugfix branches
>> etc. It
>> is useful to have these available in the same eclipse workspace, but
>> it is not
>> possible to have the classpath work for each version of the project as
>> they have different mount points.
>
> Actually this is a problem for different projects also. As an example :-
>
> If we have two projects that use tomcat. The tomcat libraries are kept
> under source control so we would have a directory structure that looks
> something like e.g.
>
> /tomcat/....
> /project1/...
> /project2/...
>
> when these get mounted as part of a clearcase view you get a structure
> that looks like
> /view1/tomcat/...
> /view1/project1/..
> etc.
>
> and a different view for the second project might look like
>
> /view2/tomcat/....
> /view2/project2/....
>
> So the path to the tomcat libraries is different in each case.
>
> It is useful and convenient to have both these projects available
> in the same eclipse workspace, but it is not possible to make the classpath
> work for both.

Two thoughts:
1) Isn't there a ClearCase plugin for Eclipse? I would think it would
help manage this kind of thing because the idea of mounted views is so
proprietary to ClearCase*.

2) Why not make the tomcat directory into a project and then the other
projects can depend on it instead of having to point to its physical
file-system location. Project references are always relative to the
workspace so there would be no classpath issues.

Hope this helps,
Eric

* Aside/rant: ClearCase has always bugged me because SCM should never
get in your way, it should be transparent most of the time other than
when you want to commit; but CC always seems to be getting in the way
and wants to do things completely differently than every other SCM system.
Re: Project local classpath [message #248130 is a reply to message #248037] Wed, 06 February 2008 14:49 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: wegener.cboenospam.com

"Andy Ling" <andy.ling@quantel.com> wrote in message
news:9397cc42cb4bea4ec3bd58631dcfea8d$1@www.eclipse.org...
> Dave Wegener wrote:
>
>
> > You can define either a classpath variable or a linked resource to
represent
> > the root of the filesystem. You then set the variable in the workspace
to
> > point to view1 or view2. Since the variable is shared between all
projects
> > in a workspace, you would only be able to see one version at a time.
This
> > is why you need to have different versions in different workspaces.
> >>
>
> This is the trouble. What I have described is two different projects
> that are in the same workspace. They both use the "tomcat" resource, but
it
> is mounted under a different root. So I need a different classpath for
> each project. Classpath variables would work if they could be set
> differently for each project. As they can't it looks like I can't
> do what I want. Unless I'm missing something.
If the tomcat reference means different things to different projects, then
you should probably have two classpath variables. Have one project refer to
tomcat-version-1 and the other project refer to tomcat-version-2. We use
ClearCase for our SCM and have used this method effectivly for some time and
have not run into the problems that you mention.

>
> Having them in different workspaces is a pain. It means restarting eclipse
> to switch and sharing or comparing between projects becomes difficult.
>
> What do you mean by "linked resource"? Would that give me what I want?
>
Linked resources allow you to link files from outside your project into the
project folder hierarchy. They have a concept of path variables which is
very similar to classpath variables. The path variables map a variable name
to a location on your file system. You can search for Linked Resources in
the Help to find out more abou them.

> Thanks for your help
>
>
>
Re: Project local classpath [message #248215 is a reply to message #248068] Thu, 07 February 2008 05:52 Go to previous messageGo to next message
Eclipse UserFriend
Eric Rizzo wrote:

> Two thoughts:
> 1) Isn't there a ClearCase plugin for Eclipse? I would think it would
> help manage this kind of thing because the idea of mounted views is so
> proprietary to ClearCase*.

Yes there is a plugin, which we use, but maybe we don't make use
of all of its facilities. I will do some more investigation.

Thanks for the pointer

> 2) Why not make the tomcat directory into a project and then the other
> projects can depend on it instead of having to point to its physical
> file-system location. Project references are always relative to the
> workspace so there would be no classpath issues.

We want tomcat to stay with the project so that if we pick a particular
version of a project it gets the version of tomcat that goes with it.

Dave's suggestion of different classpath variables in each project
will probably help. But it doesn't fix the problem if we have
two versions of the same project in the same workspace.

I think we've probably done this to death now. The simple answer is
there isn't a way to do what I want. So I'll have to cahnge the way we
work until I can persuade someone to implement per project variables :-)

Thanks for all the help

> * Aside/rant: ClearCase has always bugged me because SCM should never
> get in your way, it should be transparent most of the time other than
> when you want to commit; but CC always seems to be getting in the way
> and wants to do things completely differently than every other SCM system.

In general I like CC and most of the time it doesn't get in the way.
I'm not sure any other SCM system would have helped in these circumstances.
If you have two version of the same source tree, presumably they
have to have a different root, but will share a project configuration.

Anyway, I shouldn't really have risen to this comment. Here be the
path of religious wars :-)
Re: Project local classpath [message #248243 is a reply to message #248215] Thu, 07 February 2008 10:33 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: eclipse-news.rizzoweb.com

Andy Ling wrote:
> Eric Rizzo wrote:
>> 2) Why not make the tomcat directory into a project and then the other
>> projects can depend on it instead of having to point to its physical
>> file-system location. Project references are always relative to the
>> workspace so there would be no classpath issues.
>
> We want tomcat to stay with the project so that if we pick a particular
> version of a project it gets the version of tomcat that goes with it.
>
> Dave's suggestion of different classpath variables in each project
> will probably help. But it doesn't fix the problem if we have
> two versions of the same project in the same workspace.

I see. What I usually do for projects that have important dependencies
(that is, almost every project I work on) is to include the dependencies
in the project itself. For JARs that just means a lib/ directory; for
Tomcat it might mean slightly more (as it does for Jetty, which I've
used more often); but the principal is the same - include everything
that is needed to build and run the application either in the one
project or have several projects that must be synchronized together.
Since you are trying to have several versions in one workspace,
embedding Tomcat in the main project would meet that goal, if there is
nothing else preventing you from doing it.


> I think we've probably done this to death now. The simple answer is
> there isn't a way to do what I want. So I'll have to cahnge the way we
> work until I can persuade someone to implement per project variables :-)

Please file an enhancement request in Bugzilla for project classpath
variables - at least someone will either take up the work to implement
it, shoot down the idea, or ask you to commit a patch for it ;-)

Eric
Re: Project local classpath [message #248261 is a reply to message #248243] Thu, 07 February 2008 11:29 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: wegener.cboenospam.com

"Eric Rizzo" <eclipse-news@rizzoweb.com> wrote in message
news:fof8bs$1tg$1@build.eclipse.org...
> Andy Ling wrote:
> > Eric Rizzo wrote:
> >> 2) Why not make the tomcat directory into a project and then the other
> >> projects can depend on it instead of having to point to its physical
> >> file-system location. Project references are always relative to the
> >> workspace so there would be no classpath issues.
> >
> > We want tomcat to stay with the project so that if we pick a particular
> > version of a project it gets the version of tomcat that goes with it.
> >
> > Dave's suggestion of different classpath variables in each project
> > will probably help. But it doesn't fix the problem if we have
> > two versions of the same project in the same workspace.
>
> I see. What I usually do for projects that have important dependencies
> (that is, almost every project I work on) is to include the dependencies
> in the project itself. For JARs that just means a lib/ directory; for
> Tomcat it might mean slightly more (as it does for Jetty, which I've
> used more often); but the principal is the same - include everything
> that is needed to build and run the application either in the one
> project or have several projects that must be synchronized together.
> Since you are trying to have several versions in one workspace,
> embedding Tomcat in the main project would meet that goal, if there is
> nothing else preventing you from doing it.
>
ClearCase actually can help with this. I should have thought of it sooner.
You can create a ClearCase symbolic link that points to an element within a
ClearCase vob. For example, most of our projects have a lib folder that
contains symbolic links to jar files that the project depends on. ClearCase
uses the config spec rules to pick the version of the jar file that is
available in a given view. This way, you may not need to use a ClassPath
variable. If you create the library folder under your project, you can just
use the Add Jar option.

This might solve your problem. Different projects would reference the Tomcat
version based on the projects config spec. Different versions of the same
project would each reference the version specific to them.

I would still recomend against having multiple versions of a project in the
same workspace. It's too easy to loose track of which version you are
working on and change the wrong version by mistake. If you have the
ClearCase plugin installed, you can use the compare with previous or version
tree menu options to compare changes between versions.

>
> > I think we've probably done this to death now. The simple answer is
> > there isn't a way to do what I want. So I'll have to cahnge the way we
> > work until I can persuade someone to implement per project variables :-)
>
> Please file an enhancement request in Bugzilla for project classpath
> variables - at least someone will either take up the work to implement
> it, shoot down the idea, or ask you to commit a patch for it ;-)
>
> Eric
Re: Project local classpath [message #248302 is a reply to message #248261] Thu, 07 February 2008 16:37 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: eclipse-news.rizzoweb.com

Dave Wegener wrote:
> This might solve your problem. Different projects would reference the Tomcat
> version based on the projects config spec. Different versions of the same
> project would each reference the version specific to them.
>
> I would still recomend against having multiple versions of a project in the
> same workspace. It's too easy to loose track of which version you are
> working on and change the wrong version by mistake. If you have the
> ClearCase plugin installed, you can use the compare with previous or version
> tree menu options to compare changes between versions.

Speaking from experience, I can strongly second that advice. When you
have multiple versions of the same code base in the same workspace, it
is not a question of "if" you will confuse them, but rather a question
of "when" and "how often" and "to what level of consequences."

Eric
Re: Project local classpath [message #248354 is a reply to message #248261] Fri, 08 February 2008 05:41 Go to previous message
Eclipse UserFriend
Dave Wegener wrote:


> "Eric Rizzo" <eclipse-news@rizzoweb.com> wrote in message
> news:fof8bs$1tg$1@build.eclipse.org...
>> Andy Ling wrote:
>> > Eric Rizzo wrote:
>> >> 2) Why not make the tomcat directory into a project and then the other
>> >> projects can depend on it instead of having to point to its physical
>> >> file-system location. Project references are always relative to the
>> >> workspace so there would be no classpath issues.
>> >
>> > We want tomcat to stay with the project so that if we pick a particular
>> > version of a project it gets the version of tomcat that goes with it.
>> >
>> > Dave's suggestion of different classpath variables in each project
>> > will probably help. But it doesn't fix the problem if we have
>> > two versions of the same project in the same workspace.
>>
>> I see. What I usually do for projects that have important dependencies
>> (that is, almost every project I work on) is to include the dependencies
>> in the project itself. For JARs that just means a lib/ directory; for
>> Tomcat it might mean slightly more (as it does for Jetty, which I've
>> used more often); but the principal is the same - include everything
>> that is needed to build and run the application either in the one
>> project or have several projects that must be synchronized together.
>> Since you are trying to have several versions in one workspace,
>> embedding Tomcat in the main project would meet that goal, if there is
>> nothing else preventing you from doing it.
>>
> ClearCase actually can help with this. I should have thought of it sooner.
> You can create a ClearCase symbolic link that points to an element within a
> ClearCase vob. For example, most of our projects have a lib folder that
> contains symbolic links to jar files that the project depends on. ClearCase
> uses the config spec rules to pick the version of the jar file that is
> available in a given view. This way, you may not need to use a ClassPath
> variable. If you create the library folder under your project, you can just
> use the Add Jar option.

Yes, we use symbolic links and this does go some way to helping.

To some extent this example is slightly artificial to try and describe
what I wanted.

I would have liked a single classpath variable in every project e.g. ROOT
that everyone knew about and was defined to point to the name of the
clearcase view. It looks like we have to have p1-root, p2-root etc.

> This might solve your problem. Different projects would reference the Tomcat
> version based on the projects config spec. Different versions of the same
> project would each reference the version specific to them.

> I would still recomend against having multiple versions of a project in the
> same workspace. It's too easy to loose track of which version you are
> working on and change the wrong version by mistake.

I hear what you are saying. In practice, what I have is several version
of the same project "available" in a workspace, but only one open
at any given time. I just find this an easier way of working
rather than keep switching workspace. Switching workspace involves
restarting eclipse and there are issues with keeping preferences
common between workspaces. (Particularly as being a fairly novice
user I'm still tweaking things :-)

Thanks for all the help

Andy
Previous Topic:Content/Code Assist Menu items
Next Topic:Eclipse on Windows 64 bits
Goto Forum:
  


Current Time: Wed Apr 30 07:40:10 EDT 2025

Powered by FUDForum. Page generated in 0.10353 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top