Ant 构建失败,没有可见错误 [英] Ant build fails with no visible errors

查看:39
本文介绍了Ant 构建失败,没有可见错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最终在 Eclipse 中设置了整个项目,并且能够构建它.我不知道为什么会出现这个问题,希望我永远不必找出来.

我遇到了一个问题,我的构建报告BUILD FAILED"而没有报告任何错误.

我正在构建一个包含大量旧代码的大型应用程序,现在我可以很高兴地修改这些代码.大多数其他开发人员已经使用 Eclipse 设置了他们的构建,但我正在尝试通过现有的 build.xml 文件构建它.

设置类路径后,构建运行顺利,但在开始编译步骤后不久,它返回:

<块引用>

很多[javac] file.java"行.构建失败<项目路径>/build.xml:201:编译失败;有关详细信息,请参阅编译器错误输出.

这没什么帮助.build.log 除了堆栈跟踪之外没有其他信息:

<块引用>

at org.apache.tools.ant.taskdefs.Javac.compile(Javac.java:1085)在 org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:885)在 org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)在 sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)在 sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)在 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)在 java.lang.reflect.Method.invoke(Method.java:585)在 org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)在 org.apache.tools.ant.Task.perform(Task.java:348)在 org.apache.tools.ant.Target.execute(Target.java:357)在 org.apache.tools.ant.Target.performTasks(Target.java:385)在 org.apache.tools.ant.Project.executeSortedTargets(Project.java:1337)在 org.apache.tools.ant.Project.executeTarget(Project.java:1306)在 org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)在 org.apache.tools.ant.Project.executeTargets(Project.java:1189)在 org.apache.tools.ant.Main.runBuild(Main.java:758)在 org.apache.tools.ant.Main.startAnt(Main.java:217)在 org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)在 org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)

-debug 标志添加到 ant 会产生大量信息,而且类路径如此长(有很多 jar),很难对其进行分类.

这是ant中的目标:

<块引用>

 <目标名称="编译"取决于="achmetadata"><mkdir dir="${path.build.classes}"/><javac列表文件=是"destdir="${path.build.classes}"classpathref="project.classpath"调试=开"弃用 =开"叉=是"nowarn =否"memoryMaximumSize="512M"srcdir="${path.src.java}"来源=1.4"目标=1.4">-><src path="${path.build.src}"/><patternset refid="生产代码"/></javac></目标>

类路径是通过 classpathref 设置的,并且通过 和 标签包含了很多 jar.

对我应该寻找什么有任何想法吗?什么会导致蚂蚁像这样失败?

解决方案

你能在调试模式下运行你的 ant 构建,以便你可以单步调试吗?在 build.xml 中设置一个断点.然后右键单击 build.xml 并选择 Debug As -> Ant Build(假设您使用的是 Eclipse).这可能会帮助您找出您的问题.

HTH.

EDIT: I ended up setting up the whole project in Eclipse and was able to get it to build. I'm not sure why this problem occurred and hopefully I'll never have to find out.

I'm having a problem where my build is reporting "BUILD FAILED" without reporting any errors.

I'm building a large application of a lot of old code which I now have the joy of modifying. Most of the other developers have set up their builds with Eclipse, but I'm trying to build it through the existing build.xml files.

After getting my classpath set, the build runs smoothly, but shortly after starting the compile step, it returns:

Lots of "[javac] file.java" lines.

BUILD FAILED
<project path>/build.xml:201: Compile failed; see the compiler error output for details.

This is less than helpful. The build.log has no additional information other than the stack trace:

at org.apache.tools.ant.taskdefs.Javac.compile(Javac.java:1085)
at org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:885)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
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:1337)
at org.apache.tools.ant.Project.executeTarget(Project.java:1306)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1189)
at org.apache.tools.ant.Main.runBuild(Main.java:758)
at org.apache.tools.ant.Main.startAnt(Main.java:217)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)

Adding the -debug flag to ant creates mountains of information, and with such a long classpath (so many jars) it is hard to sort through it.

Here's the target in ant:

  <target name="compile" depends="achmetadata">
    <mkdir dir="${path.build.classes}"/>
    <javac
      listfiles="yes"
      destdir="${path.build.classes}"
      classpathref="project.classpath"
      debug="on"
      deprecation="on"
      fork="yes"
      nowarn="no"
      memoryMaximumSize="512M"
      srcdir="${path.src.java}"
      source="1.4"
      target="1.4"
      >
    -><src path="${path.build.src}"/>
      <patternset refid="production-code"/>
    </javac>
  </target>

The classpath is set through that classpathref and has a lot of jars included through and tags.

Any thoughts on what I should be lookinf for? What would cause ant to fail like this?

解决方案

Can you run your ant build in debug mode so that you can step through it? Set a break point in your build.xml. Then Right click on the build.xml and select Debug As -> Ant Build (assuming you are using Eclipse). This might help you to figure out your issue.

HTH.

这篇关于Ant 构建失败,没有可见错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆