tmp0 and other server directories [message #157426] |
Fri, 20 January 2006 07:08 |
Eclipse User |
|
|
|
Originally posted by: dwelzel+eclipse.gmail.com
Is there any way to find out the directory to which your server is
deployed? I have several ant scripts and other projects which drop jars
into the shared folder of my server and I find I have to hard code the
path to the server, which is a bit of a pain. In particular, the
directory changes to tmp1 (etc) if you recreate the server project. I'd
like to find a cleaner way to get this data or deploy jars out to
specific directories on the server.
|
|
|
Re: tmp0 and other server directories [message #157442 is a reply to message #157426] |
Fri, 20 January 2006 09:04 |
Eclipse User |
|
|
|
Originally posted by: alex_blewitt.yahoo.com
The server configuration is stored as an XML file somewhere in the .metadata directory for the core servers directory, and each new Servers project results in a new entry for a server-specific configuration which amongst other things has the path to the temp directory. If you can find the right file, and you have suitable XML parsing tools, then you could probably do some introspection and pull out the directory of the server with a given name.
But it's probably easier just to hard-code it and change it when necessary :-)
Alex
|
|
|
Re: tmp0 and other server directories [message #157535 is a reply to message #157442] |
Fri, 20 January 2006 17:47 |
Eclipse User |
|
|
|
Originally posted by: dwelzel+eclipse.gmail.com
Thanks, that's helpful information. In this case I am giving WTP
project to the people so I want to make things as seamless as possible
for them. If that means munging through some hidden xml file somewhere,
then so be it.
Alex Blewitt wrote:
> The server configuration is stored as an XML file somewhere in the .metadata directory for the core servers directory, and each new Servers project results in a new entry for a server-specific configuration which amongst other things has the path to the temp directory. If you can find the right file, and you have suitable XML parsing tools, then you could probably do some introspection and pull out the directory of the server with a given name.
>
> But it's probably easier just to hard-code it and change it when necessary :-)
>
> Alex
|
|
|
Re: tmp0 and other server directories [message #157582 is a reply to message #157535] |
Sat, 21 January 2006 00:39 |
Eclipse User |
|
|
|
Originally posted by: alex_blewitt.yahoo.com
The other approach would be to interact with the code via API:
http://help.eclipse.org/help31/index.jsp?topic=/org.eclipse. wst.doc.isv/reference/api/org/eclipse/wst/server/core/Server Core.html
You should be able to get hold of all Serves via ServerCore.getServers(), and then iterate through those. There's also a ServerCore.getDefaultServer(), which might be useful if you only have one. From that, you can getRuntime(), which has a getLocation() that might also help you locate the right place to go. (There's also a working copy, which is likely to correspond with the tmp directories.)
One advantage of using the API (if it works) is that you don't have to write the parsing stuff yourself. On the other hand, it maybe a waste of time investigating :-) At the very least, you'll be able to get the Server's ID, which is fairly likely to correspond with the integer after the tmp in the directory name, I'm guessing.
Alex.
|
|
|
Powered by
FUDForum. Page generated in 0.03020 seconds