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 |
Steve Cohen Messages: 46 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 |
David Wegener Messages: 1445 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 #260578 is a reply to message #260571] |
Thu, 11 June 2009 20:06 |
Eclipse User |
|
|
|
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.
|
|
| |
Goto Forum:
Current Time: Thu Sep 19 00:54:57 GMT 2024
Powered by FUDForum. Page generated in 0.26012 seconds
|