You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by Shorn Tolley <sh...@hotmail.com> on 2002/06/02 17:40:44 UTC
Modifying Ant reporting behaviour when javac fails
Context:
Running an Ant target that uses the 'javac' task from an IDE, specifically
NetBeans or Emacs.
The symptom:
When compiling with Ant and getting a compile error, as well as reporting
the location of the actual syntax errors, Ant also reports the location of
the 'javac' task that (because of the syntax errors) failed.
The problem:
IDEs that scan the output of ant looking for <file>:<line>:<message> type
strings pick up the build failure message as a syntax error, which means
that when you're navigating through the list of errors and you go one too
far (or go to the last one), the IDE will open the build.xml file.
It's not a big deal, it's just annoying.
The solution:
I am of the opinion that Ant should not report the compile failed message in
the format <file>:<line>:<message> but in the format <message>. So you will
still see the message, it just won't look like an error with the build file
(which, in this one specific example, it's not).
Let me be clear, I am not saying all build exceptions should be reported
without location info, just this one specific exception thrown in this
particular circumstance.
The code:
It's a one line change in Javac.java, putting an empty Location into the
BuildException that gets thrown when the CompilerAdapter returns false from
the execute() method.
I have it working on my machine and I've integrated it with NetBeans and it
works great.
What now:
I think this change should be part of Ant, but I don't know what the process
is from here (never worked on an Open Source project before). I guess the
first step is proving that people other than myself find this really
annoying? Should I submit a change request in Bugzilla?
This message is a lot of words to justify a one line change isn't it? :)
Thanks,
Shorn.
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Modifying Ant reporting behaviour when javac fails
Posted by Diane Holt <ho...@yahoo.com>.
--- Shorn Tolley <sh...@yahoo.co.uk> wrote:
> That way ties two separate modules together by the content of an error
> string. In terms of making that a part of Ant, that would make the
> overrall structure of ant more rigid.
Wasn't suggesting it become part of Ant, since it's highly unlikely that
it ever would (although I'm not sure what you mean by it affecting "the
overall structure", since it's just a logger). And I'm afraid your
suggested change to Javac is also unlikely to ever get accepted, since all
it takes is one -1, and I'm gonna guess there'd be at least that.
> In terms of a custom solution, I would then have to configure every
> project with that custom class, and supply that custom class somewhere.
Well, you're going to have to customize something somewhere along the line
to get the behaviour you're looking to get. And a custom logger would be
considerably easier to deal with than a customized Javac.java (I know, I
had one for quite some time, along with a custom Target.java and
DefaultLogger.java, and upgrades were a PITA).
Diane
=====
(holtdl@yahoo.com)
__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Modifying Ant reporting behaviour when javac fails
Posted by Shorn Tolley <sh...@yahoo.co.uk>.
--- Diane Holt <ho...@yahoo.com> wrote:
> Is there some reason you don't want to just use the
> logger I wrote that
> does this?
>
> Diane
That way ties two separate modules together by the
content of an error string. In terms of making that a
part of Ant, that would make the overrall structure of
ant more rigid. In terms of a custom solution, I
would then have to configure every project with that
custom class, and supply that custom class somewhere.
It seems easier to just make javac not report the
message as a syntax error, since in the majority of
cases, it's not.
Shorn
__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Modifying Ant reporting behaviour when javac fails
Posted by Diane Holt <ho...@yahoo.com>.
Is there some reason you don't want to just use the logger I wrote that
does this?
Diane
=====
(holtdl@yahoo.com)
__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Modifying Ant reporting behaviour when javac fails
Posted by Shorn Tolley <sh...@yahoo.co.uk>.
> Not only is this not a problem, it is actually
> useful. When your build
> file contains multiple <javac> tasks it is useful to
> be able to click on
> the one which caused the error and go straight to
> it. In some cases
> <javac> problems have nothing to do with the source
> and more to do with
> the way the <javac> task is setup (classpaths, etc).
>
> Conor
True, but I debug the code I'm writing a lot more than
I debug the build file.
Keep in mind that I'm talking about this as a problem
in the context of using Ant from within an IDE.
During the development cycle I most often just run one
focused target, as opposed to running the 'all'
target.
It could also be an opt-in or opt-out option. Or be
added to the effect of specifying -emacs on the
command line. Anything really, just so I don't have
to pay stupid-tax on it :)
Shorn.
__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Modifying Ant reporting behaviour when javac fails
Posted by Conor MacNeill <co...@cortexebusiness.com.au>.
Shorn Tolley wrote:
> The problem:
> IDEs that scan the output of ant looking for <file>:<line>:<message> type
> strings pick up the build failure message as a syntax error, which means
> that when you're navigating through the list of errors and you go one too
> far (or go to the last one), the IDE will open the build.xml file.
> It's not a big deal, it's just annoying.
Not only is this not a problem, it is actually useful. When your build
file contains multiple <javac> tasks it is useful to be able to click on
the one which caused the error and go straight to it. In some cases
<javac> problems have nothing to do with the source and more to do with
the way the <javac> task is setup (classpaths, etc).
Conor
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>