JRuby - Warbler does not preserve symbolic links

2019-05-17 01:21发布

问题:

When packaging the application using warbler, the symbolic links are lost and the actual contents the symlink points to are packaged as part of the WAR.

In my case, I have a symlink from public/images/upload to /var/myproject/upload. After I deploy the war in tomcat, in the exploded folder public/images/upload has all the contents of /var/myproject/upload copied to it instead of linking to the folder.

UPDATE: My questions is "will warbler retain the symbolic links inside the project when deployed as a war?"

Environment Info:

jruby 1.6.2 (ruby-1.8.7-p330) | warbler 1.3.1 | Cent OS 5.5 | Java SE "1.6.0_26"

回答1:

Warbler does not support symbolic links currently, so it tries to copy its contents. Your best bet is to configure Warbler to ignore the link and post process the .war file with some other program that would store the link.

Feel free to file a feature request for this, or better, submit a patch/pull request.



回答2:

I had the same problem. I solved it by creating global (@@) variables for each path that I used in the environment files. For example my production.rb file contains @@rejectedPage="/pathto/page/in/tomcat", while in my development.rb file I set @@rejectedPage="/the/normal/path". This way I can easily switch from my development environment to my production environment.