views:

781

answers:

2

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

+6  A: 

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
Jim T
A: 

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.

Mike Quentel