开发者

AppEngine with Eclipse - Common war/ resources

I have been creating Google AppEngine projects using Eclipse SDK 3.6.1.

In all of the projects I have a StyleSheet default.css (all seperate copies) that I have in the war folder.

I would like to keep开发者_如何学C this file in one place to be included in all of the projects.

I have created a copy in the workspace folder.

I have tried linking the file into the war folder, it shows up as a linked file, I can edit it, and all looks fine.

When I run the application I can see by the webpage created that it is not recognizing the linked file.

I hope that I am missing something simple, I do not like keeping multiple copies of a common resource.

Any ideas?

Thanks,

RRaney


Creating a symbolic link to the file will do the job.

For example, on a Windows 7/Vista machine, run a command like this from the shell (as an administrator) to link two folders:

mklink /D C:\workspace\YetAnotherAppEngineProject\war\shared C:\workspace\SharedResourcesProject\shared

I assume that when you wrote "I have tried linking the file into the war folder" you meant that you tried linking a file/folder into the war folder using Eclipse's linked file/folder functionality. These links are limited to the Eclipse IDE and managed by it (int the .project file) - the Google App Engine runtime doesn't recognize them since it accesses the file system directly and not through Eclipse.

A symbolic link is done at the file-system level, and Google App Engine will recognize and respect it properly.

To create a symbolic link, use the "ln" shell command on Linux. On Windows Vista/7 use "mklink" (earlier Windows versions only have "hard links" which are not as nice for this purpose but should also get the job done, see the "linkd" command).


Have you tried "Static Files and Resource Files"?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜