将夜间构建作为 XP 计划任务运行 - 类路径问题
我在我的计算机上运行 JUnit nightly builds 作为 Windows XP 中的计划任务。 我的应用程序使用 Jaxb,因此某些测试需要使用系统类路径引用 xsd 架构。 当夜间构建在我不在计算机上时运行时,我收到如下错误:
java.lang.Exception: Unable to load schema mySchema.xsd from classpath
但是,当我手动运行构建时,我没有收到此类错误。 我的架构位置的环境变量是系统变量,而不是用户变量,所以我不知道是什么导致了此错误。 导致此错误的原因可能是什么?
编辑: 像 Hudson 这样的替代方案不是我所要求的。 我正在寻求上述技术的解决方案(批处理文件作为计划任务运行)。
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).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我怀疑您的工作目录与您期望的不同(而不是具体的类路径变量)。 如果您以用户身份运行此计划任务还是以系统任务运行此计划任务,这并不是立即显而易见的。 无论哪种情况,都值得找出任务运行的确切位置。
也就是说,虽然我曾经使用 Windows XP 计划任务设置自动构建(正如您现在所做的那样),但我们目前使用 巡航控制。 简而言之,这与您正在做的事情(定期运行构建)没有太大区别,但它 提高您的灵活性。 在这里,CruiseControl 最有价值的功能是检测已提交的更改,然后仅运行构建。 我们现在可以在提交后 10 分钟内发现损坏的构建、损坏的单元测试等。
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.
hudson 是另一个持续集成引擎,设置非常简单:
Hudson 提供以下功能:
hudson.war,或将其部署在 servlet 中
容器。 无需额外安装,无需
数据库。
完全由其友好配置
具有广泛即时功能的 Web GUI
错误检查和内联帮助。 有
无需手动调整 XML
不再了,不过如果你愿意的话
所以,你也可以这样做。
生成所做更改的列表
来自 CVS/Subversion/Mercurial 的构建。 这
也是以相当有效的方式完成的
时尚,减轻负担
存储库。
大部分内容都干净可读的 URL
页面,包括一些永久链接
“最新版本”/“最新成功
构建”,这样他们就可以轻松地
从其他地方链接。
构建结果可通过RSS或电子邮件获取
故障实时通知。
构建完成后很长时间才被标记
已完成 JUnit/TestNG 测试
报告:JUnit 测试报告可以
表格、汇总和显示
具有历史信息,例如
当它开始破裂时,等等。
历史趋势被绘制成
图形。
将构建/测试负载分配给
多台计算机。 这可以让你得到
最闲的人
位于下方的工作站
开发人员的办公桌。 文件
指纹识别:Hudson 可以追踪
其中构建产生了哪些罐子,
以及哪个构建正在使用哪个
jars的版本等等。 这
甚至适用于生产的罐子
哈德逊郊外,非常适合
跟踪依赖性的项目。
通过第三方插件扩展。 你
可以编写插件来制作Hudson
支持您的工具/流程
团队使用。
hudson is another continuous integration engine, that is very very simple to setup:
Hudson offers the following features:
hudson.war, or deploy it in a servlet
container. No additional install, no
database.
configured entirely from its friendly
web GUI with extensive on-the-fly
error checks and inline help. There's
no need to tweak XML manually
anymore, although if you'd like to do
so, you can do that, too.
generate a list of changes made into
the build from CVS/Subversion/Mercurial. This
is also done in a fairly efficient
fashion, to reduce the load of the
repository.
clean readable URLs for most of its
pages, including some permalinks link
"latest build"/"latest successful
build", so that they can be easily
linked from elsewhere.
build results by RSS or e-mail to get
real-time notifications on failures.
tagged long after builds are
completed JUnit/TestNG test
reporting: JUnit test reports can be
tabulated, summarized, and displayed
with history information, such as
when it started breaking, etc.
History trend is plotted into a
graph.
distribute build/test loads to
multiple computers. This lets you get
the most out of those idle
workstations sitting beneath
developers' desks. File
fingerprinting: Hudson can keep track
of which build produced which jars,
and which build is using which
version of jars, and so on. This
works even for jars that are produced
outside Hudson, and is ideal for
projects to track dependency.
extended via 3rd party plugins. You
can write plugins to make Hudson
support tools/processes that your
team uses.
您应该查看 Hudson 或 巡航控制。 两者都易于设置,并且可以通过更多报告、控制和改进的可用性来为您解决此类问题。 您将花费更少的时间来调查构建问题。
You should check out Hudson or Cruise Control. Both are easy to setup and will take care of this type of problem for you with more reporting, control, and improved usability. You'll spend less time investigating build problems.