Hudson continuous integration server: how to see Windows mapped directories that are visible to Ant?

倖福魔咒の 提交于 2019-12-10 10:37:41

问题


Using Hudson, Ant 1.7, Tomcat 6.20, JDK 1.6 and JDK 1.5; all on Windows boxes.

My Ant build script for a WAR file uses JARs stored on a remote server. The directory path to the remote server is mapped as a network drive in Windows. A build.properties file is used to specify the paths to the JAR dependencies. When building with Ant, either at command line or in Eclipse, the WAR builds and deploys successfully.

Example from build.properties:

lib.log4j=S:/Support/JARs/log4j-1.2.15.jar

In the above entry, the mapped network drive in Windows is the "S" drive.

I am currently evaluating Hudson on my local workstation. In Hudson, if I attempt to use the mapped network drive path to the JARs, the build fails. If I copy over the JARs to a local directory (so that they are in C:/Support/JARs), the build succeeds in compiling and creating the WAR.

How can I get Hudson to respect the mapped network drive paths? Also, is there a way to avoid having to pass Ant arguments in the Hudson user interface, and instead actually use the build.properties file, instead? Hudson seems unable to read the build.properties, otherwise.

Many thanks.

Mike Quentel


回答1:


I assume you're running hudson as a windows service. The service environment is somewhat different to a normal user, for instance it will have minimal or no network priveleges. Also, drive mapping happens during logon and is specific to the user session - so services can't really see these drives, as the services may still need to run after the user has logged off and the drives unmapped.

You can try configuring the hudson service to use an account with network priveleges, and change the build scripts to use UNC paths (\server type paths)

The other alternative is to do builds in slaves which are running from a logged in user account. It'll work, but it's nasty.

Some links with useful info:

  1. INFO: Services and Redirected Drives
  2. Descriptions of some best practices when you create Windows Services



回答2:


Jim T, thank you very much for your excellent answer!

To summarise, on Windows, the Tomcat instance needs to have privileges to the Windows mapped drive (one solution to run Tomcat under a user account with these privileges), and UNC paths must be used (//remote_server_name/directory_path). On Linux, a remotely mounted Windows drive can work (using mount command).

I did not try the second suggestion of doing builds in slaves.



来源:https://stackoverflow.com/questions/1284561/hudson-continuous-integration-server-how-to-see-windows-mapped-directories-that

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!