IDE Path variables, how to use...

Hi,

I have defined a Path variable in Settings->IDE->Path variables like this: project.dir = c:\projects\myproject

Then i want to use that variable in the Settings->IDE->Resources and define a URI location like this: project.dir\WEB-INF\tld\my.tld..

I can't find any doc how to use those path variables, how do i address them?!

Thanks i advance, Frank

24 comments

Please try $project.dir$ instead.

Tom

0

Hi Tom

I have tried "$project.dir$\WEB-INF\tld\my.tld" also, still no success :(

It is still red in the resources dialog???

Cheers Frank

0

AFAIK you don't work with path variables directly, it all happens in the background. So my current understanding of the path variable mechanism is:

- you specify a path variable, e.g. lib.dir = /java/libs
- you create a module using the library /java/libs/lib.jar
-> the stored module file (*.iml) will contain $lib.dir$/lib.jar

But when you open this module for the next time the path variable is re-translated into /java/libs/lib.jar, you won't ever see the $lib.dir$.

0

That's correct. Path Variables are automatically substituted for by IDEA.
So if you setup a variable called project-root, idea will replace any paths
which contain the project-root path with the variable (hence making the
projects more sharable)

R


On 11/20/04 2:22 PM, in article
23431130.1100978536193.JavaMail.itn@is.intellij.net, "Martin Fuhrer"
<mf@fuhrer.com> wrote:

AFAIK you don't work with path variables directly, it all happens in the
background. So my current understanding of the path variable mechanism is:

- you specify a path variable, e.g. lib.dir = /java/libs
- you create a module using the library /java/libs/lib.jar
-> the stored module file (*.iml) will contain $lib.dir$/lib.jar

But when you open this module for the next time the path variable is
re-translated into /java/libs/lib.jar, you won't ever see the $lib.dir$.


0

Very strange. What advantage should that have?

Tom

0

If I have a path variable called project-root which points to
/Users/sfeir/Projects, and you create a path variable called project-root
and its path is /Users/singer/Projects, since idea uses $project-root$
internally, the path is not broken and the project works as is.

Not useless at all :)

R


On 11/21/04 7:02 AM, in article cnq03l$fel$1@is.intellij.net, "Thomas Singer
(MoTJ)" <idea@NOregnisSpam.de> wrote:

Very strange. What advantage should that have?

Tom


0

I'm not talking about the usefulness of path variables at all. Of course
they are very useful.

But why hide the path variable in the UI and only use it in configuration
files, which are typically invisible to the user? Why not be able to enter a
path like $project.root$/classes/$module.name$ and expand it internally?

Tom

0

I agree on Tom, the usability is zero for me - with these path variables.

My Path variable is pointing to an external taglib project where the tld file is placed.
So it gives no sense (to me at least) to have an absolute path in my URI in the current JSP file - like:

<%@taglib uri="c:\projects\taglib\defs\my.tld" prefix....

It would be much smarter and give more sense, like this:

<%@taglib uri="$taglib_project$\defs\my.tld" prefix....

I would call it a usability bug, since it should work as the well known environment settings: $TAGLIB_PROJECT or %TAGLIB_PROJECT% people already know how this works....

Actually the IDEA should suggest a Path variable each time an external path is used inside the project files, instead of just putting an absolute (or relative) path. People never see what is going on the project files – and shouldn’t.

Cheers Frank

0

Well doing that with a Tag lib would completely shoot up any chance of you
being able to write an antscript, further using a path variable in a JSP tag
will not be translated properly by your web container because it will not
understand what the heck it means. Idea just copies the JSPs over to the
exploded dir and Tomcat deals with it from there, IDEA does nothing extra on
that end, and nor should it. Imagine what would happen if you had this in
your repository, someone checks out your code and wants to run it in tomcat?
How would you get around that one?

R


On 11/22/04 4:24 AM, in article
24897795.1101115498085.JavaMail.itn@is.intellij.net, "Frank Nielsen"
<no_mail@jetbrains.com> wrote:

I agree on Tom, the usability is zero for me - with these path variables.

My Path variable is pointing to an external taglib project where the tld file
is placed.
So it gives no sense (to me at least) to have an absolute path in my URI in
the current JSP file - like:

<%@taglib uri="c:\projects\taglib\defs\my.tld" prefix....

It would be much smarter and give more sense, like this:

<%@taglib uri="$taglib_project$\defs\my.tld" prefix....

I would call it a usability bug, since it should work as the well known
environment settings: $TAGLIB_PROJECT or %TAGLIB_PROJECT% people already know
how this works....

Actually the IDEA should suggest a Path variable each time an external path is
used inside the project files, instead of just putting an absolute (or
relative) path. People never see what is going on the project files ? and
shouldn?t.

Cheers Frank


0

Enter a path like that where? There was already a bad example for jsp tags,
where else would you use this Thomas?

R


On 11/22/04 2:46 AM, in article cns5f3$ju9$1@is.intellij.net, "Thomas Singer
(MoTJ)" <idea@NOregnisSpam.de> wrote:

I'm not talking about the usefulness of path variables at all. Of course
they are very useful.

But why hide the path variable in the UI and only use it in configuration
files, which are typically invisible to the user? Why not be able to enter a
path like $project.root$/classes/$module.name$ and expand it internally?

Tom


0

where else would you use this Thomas?


E.g. in library or output paths.

Tom

0

yes, your right that the Path variable cannot be in the URI path of the tablib, i was too fast in my example there ;)

What i ment was: That in the Resources dialog where you define a URI of a taglib, you should be possible to use a path variable in the location path of your tld.

See an example in my first reply to Tom...

0

It does that for you automatically, in both cases, you just don't see it.

R


On 11/22/04 8:33 AM, in article cnspqf$j43$1@is.intellij.net, "Thomas Singer
(MoTJ)" <idea@NOregnisSpam.de> wrote:

>> where else would you use this Thomas?


E.g. in library or output paths.

Tom


0

It does that for you automatically, in both cases, you just don't see it.


And exactly this is the problem. I want to see it, because in 99% the path
is shorter, when using a variable.

Tom

0

Oh you want to see it, not use it :)

Hey file an SCR :)

R


On 11/22/04 9:07 AM, in article cnsrqk$3bi$1@is.intellij.net, "Thomas Singer
(MoTJ)" <idea@NOregnisSpam.de> wrote:

>> It does that for you automatically, in both cases, you just don't see it.


And exactly this is the problem. I want to see it, because in 99% the path
is shorter, when using a variable.

Tom


0

I really would like to be able to use path variables in my Run/Debug Configurations, so if you do create a request, please post the link and I will vote for it.

0

Path variables are IDE specific, not project specific, I wish they were
project specific, further run/debug configs are not project or module
specific they're workspace specific, something I've been bitching about for
a while.

R


On 11/22/04 11:03 AM, in article
2338616.1101139380385.JavaMail.itn@is.intellij.net, "Mattias J"
<no_mail@jetbrains.com> wrote:

I really would like to be able to use path variables in my Run/Debug
Configurations, so if you do create a request, please post the link and I will
vote for it.


0

IDE wide works for me. I want to set up the path of a third party API (in this case AspectWerkz) and reference it (in a bootclasspath) in the Run/Debug config, without the need to make 10 changes on one line whenever the API is updated.

0

Thanks to this thread, i finally got it how to use the Path-Variables. In fact the usage was just too easy for me ;)

But i use it for a shortcomming with windows. In the resource settings, i am defining a lot of TLDs and point them to my library folders on my harddisk. Now i could have a path like "c:\development\libraries\struts-1.1" whereas when i upgrage, i would have a path like "c:\development\libraries\struts-1.2", making my resource settings invalid. Normal operating systems have symlinks for that kind of issues, so i could have several version-installations in my libraries folder and point them to a general "struts" folder, after all i allways would define "struts" as folder in my resource settings.

This is at laest how i would do it on linux. On Windows i use path variables for that kind of issues. So good to have them. Or does Windows have Symlinks nowadays? ]]>

Marc

0

I was tricked by IDEA or by myself, i inserted my Path-Variable into resource-path of the resource-settings and hit "browse". It directed me to the correct folder and i thought it was because of the variable, but it just was my last accessed folder. So basically it seems you cant define path variables inside the "Path" field of "Resource Settings".

marc

0

Exactly. But it sure would be useful if you could...

0

In article <19436610.1107330398159.JavaMail.itn@is.intellij.net>,
Mattias J <no_mail@jetbrains.com> wrote:

Exactly. But it sure would be useful if you could...


YEah but can you imagine all the places IDEA has to look to parse and
figure out that $ is something it should substitute?

R

0

I would normally agree that this kind of things should be done on filesystem level of the OS with symlinks.

0

Please sign in to leave a comment.