怎么看编译器输出通过Ant任务运行时的javac? [英] How to see the compiler output when running javac through an Ant task?

查看:470
本文介绍了怎么看编译器输出通过Ant任务运行时的javac?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有解释清楚和简单的方式来了解编译器输出运行 javac的时候通过的蚂蚁任务?

Is there any clearly explained and simple way to see the compiler output when running javac through an Ant task?

下面是我的的javac 蚂蚁标签:

<javac srcdir="${myproject.src}" destdir="${myproject.class}">
    <!-- ... -->
</javac>

下面是唯一的错误信息获取:

Here is the only error message I get:

/path/to/build.xml:42: Compile failed; see the compiler error output for details.

问题是,我不知道怎么的详见 ...

一些配置元素,可以帮助:

Few configuration elements that may help:


  • 蚂蚁1.6.5

  • Windows 7的64

  • 的Java 1.6.0_20 X32

  • 通过Eclipse启动目标

我知道有对SO一些相关回答问题,但他们没有真正回答这个简单的问题:

I know there are some related answered questions on SO, but none of them really answers this simple questions:

  • http://stackoverflow.com/a/1275552/1225328: I can't add the specific library that allows the compile tag;
  • http://stackoverflow.com/a/1264622/1225328: this manages Ant's output rather than the compiler's one;
  • Compile failed; see the compiler error output for details: too vague to solve anything;
  • Ant : Compile failed; see the compiler error output for details: no answer...
  • etc.

推荐答案

我认为你正在寻找的详细=真正的属性。

I think you're looking for the verbose="true" attribute.

询问详细输出编译器;默认为无。

Asks the compiler for verbose output; defaults to no.

您已经在评论中提到,这并不打印错误的原因。嗯,我想其他的东西在你的情况是怎么回事。我有一个示例项目,无论哪种方式,印我的错误的原因。下面是与输出详细=FALSE

You already mentioned in the comments that this doesn't print the cause of your error. Well I think something else is going on in your situation. I have a sample project and either way the cause of my error was printed. Here's the output with verbose="false":

[mkdir] Created dir: C:\Projects\MavenSandbox\target\classes
[javac] C:\Projects\MavenSandbox\mavensandbox.xml:284: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
[javac] Compiling 3 source files to C:\Projects\MavenSandbox\target\classes
[javac] C:\Projects\MavenSandbox\src\main\java\com\sandbox\Sandbox.java:8: error: cannot find symbol
[javac]         System.out.prinln("Hello, I\'m the best!");
[javac]                   ^
[javac]   symbol:   method prinln(String)
[javac]   location: variable out of type PrintStream
[javac] 1 error

古怪而且具体到您的code导致不良的错误消息。你可以创建重现该错误的示例项目?

Something strange and specific to your code is causing the bad error message. Can you create a sample project that reproduces the error?

至于你提到的调试=真正的是不是你要找的属性。

As you mentioned, debug="true" is not the attribute you're looking for.

表示是否来源应调试信息进行编译;默认为关闭。如果设置为off,-g:没有人会为支持它的编译器在命令行上传递(为其他编译器,没有命令行参数将被使用)。如果设置为true,则DEBUGLEVEL属性的值决定了命令行参数。

Indicates whether source should be compiled with debug information; defaults to off. If set to off, -g:none will be passed on the command line for compilers that support it (for other compilers, no command line argument will be used). If set to true, the value of the debuglevel attribute determines the command line argument.

您知道,当你得到堆栈跟踪和它有行号?这就是调试=真正的一样。如果它是关闭,你没有得到行号。

You know when you get stack trace and it has line numbers in it? That's what debug="true" does. If it's off, you don't get line numbers.

这篇关于怎么看编译器输出通过Ant任务运行时的javac?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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