Running Nightly Builds as XP Scheduled Task – Classpath Issue

classpathjunitnightly-build

I'm running JUnit nightly builds on my computer as a scheduled task in Windows XP. My application uses Jaxb, therefore some of the tests need to reference xsd schemas using the system classpath. When the nightly build runs while I'm not on the computer, I get an error like this:

java.lang.Exception: Unable to load schema mySchema.xsd from classpath

However, when I run the build manually I get no such error. The environment variable for the location of my schemas is a System variable, not a User variable, so I don't know what could be causing this error. What could be cause of this error?

EDIT: Alternatives like Hudson is not what I'm asking for. I'm asking for a solution for the technology described above (batch file running as a scheduled task).

Best Answer

My suspicion is that your working directory is different from what you expect (rather than the classpath variable specifically). It's not immediately obvious if you are running this scheduled task as a user or as a system task. In either case, it's worth finding out exactly where the task is running.

That said, while I used to set up automatic builds using Windows XP scheduled tasks (exactly as you are doing now), we currently use CruiseControl. In the abstract, this isn't that much different from what you're doing (running a build regularly) but it increases your flexibility. Around here, the most valuable ability of CruiseControl is to detect that changes were committed and to only run the build then. We find out about broken builds, broken unit tests, etc., within 10 minutes of a commit now.

Related Topic