Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » Tie environment variables to classpath variables
Tie environment variables to classpath variables [message #260546] Wed, 10 June 2009 21:22 Go to next message
Steve Cohen is currently offline Steve CohenFriend
Messages: 43
Registered: July 2009
Member
Here's a feature request that some might consider oddball, but would be
very useful to me.

I have a workspace that lives on a flash drive. This flash drive moves
between two machines, a corporate-laptop that has connection to a
Subversion repository and a personal computer on which I do much
development, because, ironically, what I'm developing needs to be
developed outside the corporate firewall for more rapid code-test-deploy
cycles. Just to make things even more fun, the personal computer runs
Linux while the laptop runs Windows. And of course the subversion
repository cannot be accessed from outside the corporate firewall.

I've found the easiest way to synch up with the svn repository is simply
to move the flash drive to the corporate laptop and connect to svn from
there. It isn't perfect but it works.

Here's the annoying thing, though. Some of my projects depend on
classpath variables such as M2_REPO. M2_REPO is saved in the workspace
metadata by Eclipse Preferences as an absolute path name on the machine.
When moving back and forth between the different machines, I get Unbound
Classpath Variable errors because, of course, the linux box has no
C:\Documents and Settings\...\.m2\repository folder and the windows box
has no /home/,,,/.m2/repository directory. I should also state that the
M2 repositories are located on the hard drives of each machine rather than
on the flash drive (though even then, /media/disk/.m2/repository !=
e:\.m2\repository)

What is needed here then, is some way to define the classpath variable
M2_REPO in terms of an environment variable that would be defined
differently on each machine. The storage of this name would have to be
OUTSIDE the workspace since, because of the flash drive, the SAME
workspace lives on DIFFERENT machines, at different times. That would
solve this problem.

Or perhaps there is another way to do this I don't know about? Is there a
way to define things that live in the ECLIPSE installation rather than the
workspace?
Re: Tie environment variables to classpath variables [message #260550 is a reply to message #260546] Thu, 11 June 2009 01:38 Go to previous messageGo to next message
David Wegener is currently offline David WegenerFriend
Messages: 1351
Registered: July 2009
Senior Member
Steve Cohen wrote:
> Here's a feature request that some might consider oddball, but would be
> very useful to me.
>
> I have a workspace that lives on a flash drive. This flash drive moves
> between two machines, a corporate-laptop that has connection to a
> Subversion repository and a personal computer on which I do much
> development, because, ironically, what I'm developing needs to be
> developed outside the corporate firewall for more rapid code-test-deploy
> cycles. Just to make things even more fun, the personal computer runs
> Linux while the laptop runs Windows. And of course the subversion
> repository cannot be accessed from outside the corporate firewall.
>
> I've found the easiest way to synch up with the svn repository is simply
> to move the flash drive to the corporate laptop and connect to svn from
> there. It isn't perfect but it works.
> Here's the annoying thing, though. Some of my projects depend on
> classpath variables such as M2_REPO. M2_REPO is saved in the workspace
> metadata by Eclipse Preferences as an absolute path name on the
> machine. When moving back and forth between the different machines, I
> get Unbound Classpath Variable errors because, of course, the linux box
> has no C:\Documents and Settings\...\.m2\repository folder and the
> windows box has no /home/,,,/.m2/repository directory. I should also
> state that the M2 repositories are located on the hard drives of each
> machine rather than on the flash drive (though even then,
> /media/disk/.m2/repository != e:\.m2\repository)
>
> What is needed here then, is some way to define the classpath variable
> M2_REPO in terms of an environment variable that would be defined
> differently on each machine. The storage of this name would have to be
> OUTSIDE the workspace since, because of the flash drive, the SAME
> workspace lives on DIFFERENT machines, at different times. That would
> solve this problem.
>
> Or perhaps there is another way to do this I don't know about? Is there
> a way to define things that live in the ECLIPSE installation rather than
> the workspace?
Instead of putting your workspace on the flash drive, just put your
projects on it. Have a separate workspace on each computer that points
to the projects on the flash drive. That way, the M2_REPO variable is
defined on each platform.

After starting Eclipse, you will probably have to perform a resync on
the projects to get the workspaces back in sync.
Re: Tie environment variables to classpath variables [message #260562 is a reply to message #260550] Thu, 11 June 2009 13:11 Go to previous messageGo to next message
Steve Cohen is currently offline Steve CohenFriend
Messages: 43
Registered: July 2009
Member
Thanks! Why didn't I think of this? This is a good workaround, although
it might be a nice improvement for Eclipse to feature another level of
settings above the workspace.
Re: Tie environment variables to classpath variables [message #260566 is a reply to message #260550] Thu, 11 June 2009 13:18 Go to previous messageGo to next message
Steve Cohen is currently offline Steve CohenFriend
Messages: 43
Registered: July 2009
Member
Thinking on this some more -
is there some set of files you can copy from one place to the other that
would automatically load the projects? I suppose not, but it's worth a
thought.
Re: Tie environment variables to classpath variables [message #260568 is a reply to message #260566] Thu, 11 June 2009 13:30 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

Steve Cohen wrote:
> Thinking on this some more -
> is there some set of files you can copy from one place to the other that
> would automatically load the projects? I suppose not, but it's worth a
> thought.

Automatically load the projects in what way? There are PSF files that
can be used to load groups of files from a repository (but part of your
setup is disconnected from the repo).

PW

--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/ganymede/index.jsp?topic=/org.eclips e.platform.doc.isv/guide/workbench.htm


Re: Tie environment variables to classpath variables [message #260571 is a reply to message #260568] Thu, 11 June 2009 15:00 Go to previous messageGo to next message
Steve Cohen is currently offline Steve CohenFriend
Messages: 43
Registered: July 2009
Member
What I meant was that there are, it turns out, a number of non-default
settings I needed to change:

compiler variables
fonts
run configurations
code templates
server configurations
svn repository info (even if it doesn't work on one machine)
encodings
jres and runtimes
etc.

I was thinking that possibly copying the .metadata directory from the
flash drive workspace to the hard drive workspace would get me most of
what I needed, but would probably bring over relative paths etc. that I
don't want. If there was some relatively simple set of instructions (for
example copy .metadata directories, delete such and such subdirectories
from the copy) it would save me some time. I have several workspaces I
want to do this for,.
Re: Tie environment variables to classpath variables [message #260578 is a reply to message #260571] Thu, 11 June 2009 20:06 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: wegener.cboenospam.com

"Steve Cohen" <scohen@javactivity.org> wrote in message
news:48556c1e6f1509f68e8a3f92d6d8a1ea$1@www.eclipse.org...
> What I meant was that there are, it turns out, a number of non-default
> settings I needed to change:
>
> compiler variables
> fonts
> run configurations
> code templates
> server configurations
> svn repository info (even if it doesn't work on one machine)
> encodings
> jres and runtimes
> etc.
>
> I was thinking that possibly copying the .metadata directory from the
> flash drive workspace to the hard drive workspace would get me most of
> what I needed, but would probably bring over relative paths etc. that I
> don't want. If there was some relatively simple set of instructions (for
> example copy .metadata directories, delete such and such subdirectories
> from the copy) it would save me some time. I have several workspaces I
> want to do this for,.
>
>
>

If you set project specific settings, these will be stored in a .settings
folder in the root of your project. It is a good idea to check this to your
SCM. That way everyone shares these settings. This should take care of
some of your items. You may also want to look into Execution Environments
instead of defining specific jres/runtimes. This way you can specify that
your project requires a specific execution environment such as JavaSE-1.6.
The project will then use the best fit jre defined in your workspace. Run
configurations can be shared from the Common tab of the Run Configuration
dialog. You can specify a location to store the Run Configurations in your
project. Again checking into SCM allows others to share.

You can export/import more general preferences (fonts, code templates) from
the File->Export and File-Import dialogs. Look for Preferences.
Re: Tie environment variables to classpath variables [message #260588 is a reply to message #260578] Fri, 12 June 2009 11:43 Go to previous message
Steve Cohen is currently offline Steve CohenFriend
Messages: 43
Registered: July 2009
Member
Thanks. Some of these ideas are new to me "execution environments" and
saving "run configurations" but they sound like good ideas. Others, I was
already doing. I always version control .project and .classpath. (Why
isn't this the default?) I will look into the ones that are new to me.

But I guess the point is, we are getting away from the workspace as the
central repository for all this configuration stuff. Eclipse project
might want to look at making workspaces a bit more portable and
configurable, as with my original idea of using environment variables or
some other "higher" configuration scheme.
Previous Topic:Adding super interface : nothing happens
Next Topic:Annotation processing configuration
Goto Forum:
  


Current Time: Fri Dec 19 21:50:26 GMT 2014

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

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