Cruisecontrol 无法解析 ant 擅长的线路

发布于 2024-08-11 08:14:11 字数 2150 浏览 5 评论 0 原文

我无法让我的巡航控制脚本执行某些操作。我想对项目中的文件调用 grep 来搜索一些预处理器定义,并将它们放入列表中,以便稍后使用。当我将其放入 ant 构建文件中时,此代码片段工作正常,但在 Cruisecontrol 中使用时返回错误...

<target name="generate_list">
  <echo>calling grep</echo>
  <exec dir="${basedir}/src/" executable="grep" failonerror="true">
    <arg line="-R --include=*.{cpp,h} -l -P &quot;ARG1|ARG2|ARG3&quot; . &gt; touchlist" />
  </exec>
  <echo>contents of touchlist is</echo>
  <exec dir="${basedir}/src/" executable="cat" failonerror="true">
    <arg line="touchlist" />
  </exec>
</target>

返回的错误是

<stacktrace>
  /opt/cruisecontrol-2.8.1/build-foo.xml:195: exec returned: 1
    at org.apache.tools.ant.taskdefs.ExecTask.runExecute(ExecTask.java:636)
    at org.apache.tools.ant.taskdefs.ExecTask.runExec(ExecTask.java:662)
    at org.apache.tools.ant.taskdefs.ExecTask.execute(ExecTask.java:487)
    at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
    at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
    at org.apache.tools.ant.Task.perform(Task.java:348)
    at org.apache.tools.ant.Target.execute(Target.java:357)
    at org.apache.tools.ant.Target.performTasks(Target.java:385)
    at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
    at org.apache.tools.ant.Project.executeTarget(Project.java:1298)
    at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
    at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
    at org.apache.tools.ant.Main.runBuild(Main.java:698)
    at org.apache.tools.ant.Main.startAnt(Main.java:199)
    at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
    at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)
</stacktrace>

我在这里完全不知所措。除了逐步改变事物并看看会发生什么之外,我什至不知道如何调试这个。

I'm having trouble getting my cruisecontrol script to do something. I want to call grep on the files in my project to search for a few preprocessor defines, and place them into a list, which I can use later. This snippet works fine when I toss it into an ant buildfile, but returns an error when used in cruisecontrol...

<target name="generate_list">
  <echo>calling grep</echo>
  <exec dir="${basedir}/src/" executable="grep" failonerror="true">
    <arg line="-R --include=*.{cpp,h} -l -P "ARG1|ARG2|ARG3" . > touchlist" />
  </exec>
  <echo>contents of touchlist is</echo>
  <exec dir="${basedir}/src/" executable="cat" failonerror="true">
    <arg line="touchlist" />
  </exec>
</target>

the error returned is

<stacktrace>
  /opt/cruisecontrol-2.8.1/build-foo.xml:195: exec returned: 1
    at org.apache.tools.ant.taskdefs.ExecTask.runExecute(ExecTask.java:636)
    at org.apache.tools.ant.taskdefs.ExecTask.runExec(ExecTask.java:662)
    at org.apache.tools.ant.taskdefs.ExecTask.execute(ExecTask.java:487)
    at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
    at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
    at org.apache.tools.ant.Task.perform(Task.java:348)
    at org.apache.tools.ant.Target.execute(Target.java:357)
    at org.apache.tools.ant.Target.performTasks(Target.java:385)
    at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
    at org.apache.tools.ant.Project.executeTarget(Project.java:1298)
    at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
    at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
    at org.apache.tools.ant.Main.runBuild(Main.java:698)
    at org.apache.tools.ant.Main.startAnt(Main.java:199)
    at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
    at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)
</stacktrace>

I'm at a total loss here. I don't even know how I can debug this one, aside from changing things incrementally and seeing what happens.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

老旧海报 2024-08-18 08:14:11

另一个想法(谷歌搜索后)是避免使用 。将其替换为多个 定义。

Another idea (after googling) would be to avoid using <arg line.... Replace it with multiple <arg value... definitions.

说好的呢 2024-08-18 08:14:11

我建议您将命令行提取到一个单独的 shell 脚本中,这样您就可以只调用该脚本并让脚本调用 grep

I would suggest you extracting the command line to a separate shell script, so that you would call the script only and let the script call grep instead.

丑疤怪 2024-08-18 08:14:11

也许这是不同的基础。

在目标的第一行放置 并比较 ant-run 和 Cruisecontrol 运行的 basedir 输出。

Maybe it´s different basedirs.

Place a <echoproperties/>in the first line of your target and compare the output for basedir form the ant-run and the cruisecontrol run.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文