You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by Steve Loughran <st...@apache.org> on 2005/04/12 11:58:53 UTC
regression in handling of failures
I have it on reliable authority (chapter 5 of java development with
ant), that Ant1.5 would fail with a location error when you tried to run
<java> without a class on the classpath. But now I see a stack trace and
not a location:
[echo] running the diary program
[java] Could not find d1.core.DiaryMain. Make sure you have it in
your classpath
[java] at
org.apache.tools.ant.taskdefs.ExecuteJava.execute(ExecuteJava.java:178)
[java] at org.apache.tools.ant.taskdefs.Java.run(Java.java:731)
[java] at
org.apache.tools.ant.taskdefs.Java.executeJava(Java.java:190) [java]
at org.apache.tools.ant.taskdefs.Java.execute(Java.java:100)
[java] at
org.apache.tools.ant.UnknownElement.execute(UnknownElement.jav
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org
Re: regression in handling of failures
Posted by Erik Hatcher <er...@ehatchersolutions.com>.
On Apr 14, 2005, at 5:24 AM, Steve Loughran wrote:
> Stefan Bodewig wrote:
>> On Tue, 12 Apr 2005, Steve Loughran <st...@apache.org> wrote:
>>> I have it on reliable authority (chapter 5 of java development with
>>> ant),
>> You trust that, even though you know who's written it?
>
> I trust the chapters that Erik wrote :)
I just used XDoclet to generate everything, so any mistakes have to be
in Ant's source code :)
Erik
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org
Re: regression in handling of failures
Posted by Stefan Bodewig <bo...@apache.org>.
On Thu, 14 Apr 2005, Steve Loughran <st...@apache.org> wrote:
> It's not so much the location as the stack trace that worries
> me.
That would have been me[1] in response to people who'd like to see a
stack trace if an error occurs inside of their code.
> This is a build file error, not something internal.
So the log statement (logging of the stack trace) probably is in the
wrong place. Hmm, ExecuteJava around line 188 seems to be the better
choice, since those Throwable should be coming out of user code.
But we probably should catch the ClassNotFoundException earlier since
it could as well be coming from the user code, even if we find the
class containing main().
Stefan
Footnotes:
[1] http://cvs.apache.org/viewcvs.cgi/ant/src/main/org/apache/tools/ant/taskdefs/Java.java?r1=1.86&r2=1.87
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org
Re: regression in handling of failures
Posted by Steve Loughran <st...@apache.org>.
Stefan Bodewig wrote:
> On Tue, 12 Apr 2005, Steve Loughran <st...@apache.org> wrote:
>
>
>>I have it on reliable authority (chapter 5 of java development with
>>ant),
>
>
> You trust that, even though you know who's written it?
I trust the chapters that Erik wrote :)
>
>
>>that Ant1.5 would fail with a location error when you tried to run
>><java> without a class on the classpath.
>
>
> I also thought we'd add location information to any BuildException
> that leaves our system, strange. Kev's patch looks fine, but I wonder
> why the location was lost, need to dig through some commit logs.
>
It's not so much the location as the stack trace that worries me. This
is a build file error, not something internal.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org
Re: regression in handling of failures
Posted by Stefan Bodewig <bo...@apache.org>.
On Tue, 12 Apr 2005, Steve Loughran <st...@apache.org> wrote:
> I have it on reliable authority (chapter 5 of java development with
> ant),
You trust that, even though you know who's written it?
> that Ant1.5 would fail with a location error when you tried to run
> <java> without a class on the classpath.
I also thought we'd add location information to any BuildException
that leaves our system, strange. Kev's patch looks fine, but I wonder
why the location was lost, need to dig through some commit logs.
Stefan
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org
Re: Ant Jar doubt
Posted by Conor MacNeill <co...@apache.org>.
Raja Nagendra Kumar wrote:
>>Raja Nagendra Kumar wrote:
>>
>>>Hi,
>>>
>>>When ever we jar I see in the manifest 'Ant-Version: Apache Ant 1.6.2'
>
> this
>
>>>line. Could any one tell me how to avoid this.
>>
>>I dont know if there is a way to do this (yet)
>>
>
>
> Is there any custom tasks written by any one which could be used for this
> purpose.
>
You should be able to use the <zip> task and place your manifest in
manually.
>
>>>And also I want to put few
>>>properties of mine in a way the squence of these properties are
>
> maintinated
>
>>>in manifest. My observation here is sqence is altered.
The manifest code will maintain the order of sections in the manifest
and also the order of attributes within each section, including the main
section. The only changes Ant will make is to ensure the manifest
complies with the spec, which states:
"Manifest-Version and Signature-Version must be first, and in exactly
that case (so that they can be recognized easily as magic strings).
Other than that, the order of attributes within a main section is not
significant. "
If you use the <zip> task you should be able to put whatever you want in
the manifest, including something which is invalid. You will lose all
manifest validation logic.
>>
>>I dont believe that code should depend on the order; its part of the
>>manifest specification. We'd only be encouraging bad practices if enabled.
>
>
> This is because, my client (J2ME Game publisher) is asking for this order..
> Any case why should the oder be manipulated by the jar command. Why does it
> not take the things in way it has been provided ..
>
You're in a little bind there since the spec specifically says that
order is not significant. Nevertheless, the code does attempt to
maintain the order of things. Can you tell us what you are seeing? A
little example?
Is it worth asking your client why they require a specific order?
Conor
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org
Re: Ant Jar doubt
Posted by Steve Loughran <st...@apache.org>.
Raja Nagendra Kumar wrote:
> Hi,
>
> Thanks for the reply. My reply in-line
>
>
> ----- Original Message -----
> From: "Steve Loughran" <st...@apache.org>
> To: "Ant Developers List" <de...@ant.apache.org>
> Sent: Tuesday, April 12, 2005 4:41 PM
> Subject: Re: Ant Jar doubt
>
>
>
>>Raja Nagendra Kumar wrote:
>>
>>>Hi,
>>>
>>>When ever we jar I see in the manifest 'Ant-Version: Apache Ant 1.6.2'
>
> this
>
>>>line. Could any one tell me how to avoid this.
>>
>>I dont know if there is a way to do this (yet)
>>
>
>
> Is there any custom tasks written by any one which could be used for this
> purpose.
no, but it isnt needed,
>
>>>in manifest. My observation here is sqence is altered.
>>
>>I dont believe that code should depend on the order; its part of the
>>manifest specification. We'd only be encouraging bad practices if enabled.
>
>
> This is because, my client (J2ME Game publisher) is asking for this order..
Well, they -or the telephone provider- are not using the specification
correctly:
http://java.sun.com/j2se/1.5.0/docs/guide/jar/jar.html#Notes%20on%20Manifest%20and%20Signature%20Files
"The order of individual manifest entries is not significant."
If it is their code, their code is broken. If it is a particular phone.
I'd like to know which one. Is it a motorola phone?
> Any case why should the oder be manipulated by the jar command. Why does it
> not take the things in way it has been provided ..
Because there are lots of things the task does with manifest fixup, such
as correcting over-long lines using the official wrapping rules, and
other aspects of the manifest specification. We intermittently get
complaints about the ant code not understanding how to wrap lines or
otherwise set up JAR files, but you have to remember: Ant probably
creates the majority of the JAR files on the planet for production
applications. We follow the specs to the letter, and have to be strict.
Also, re-ordering entries stops people writing code which makes
assumptions about manifest entry order. Clearly, someone downstream from
you has done exactly that, which is why you are suffering. But we don't
do it deliberatetly, it's probably just hashTable at work.
If you don't want Ant to do your manifest
1. write it by hand
2. use the <zip> task to create the JAR
3. import the manifest at META-INF/manifest.mf
That's all. no need for custom tasks. I'd recommend you use <manifest>
to create a stub manifest that you patch by hand. That reduces the
likelihood of the manifest being wrong.
There are some extra ant tasks for j2me listed on our external task list:
http://ant.apache.org/external.html
The antic one looks like it does special J2ME stuff.
-Steve
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org
Re: Ant Jar doubt
Posted by Raja Nagendra Kumar <Na...@erasmic.com>.
Hi,
Thanks for the reply. My reply in-line
----- Original Message -----
From: "Steve Loughran" <st...@apache.org>
To: "Ant Developers List" <de...@ant.apache.org>
Sent: Tuesday, April 12, 2005 4:41 PM
Subject: Re: Ant Jar doubt
> Raja Nagendra Kumar wrote:
> > Hi,
> >
> > When ever we jar I see in the manifest 'Ant-Version: Apache Ant 1.6.2'
this
> > line. Could any one tell me how to avoid this.
>
> I dont know if there is a way to do this (yet)
>
Is there any custom tasks written by any one which could be used for this
purpose.
> > And also I want to put few
> > properties of mine in a way the squence of these properties are
maintinated
> > in manifest. My observation here is sqence is altered.
>
> I dont believe that code should depend on the order; its part of the
> manifest specification. We'd only be encouraging bad practices if enabled.
This is because, my client (J2ME Game publisher) is asking for this order..
Any case why should the oder be manipulated by the jar command. Why does it
not take the things in way it has been provided ..
Regards,
Nagendra
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
> For additional commands, e-mail: dev-help@ant.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org
Re: Ant Jar doubt
Posted by Steve Loughran <st...@apache.org>.
Raja Nagendra Kumar wrote:
> Hi,
>
> When ever we jar I see in the manifest 'Ant-Version: Apache Ant 1.6.2' this
> line. Could any one tell me how to avoid this.
I dont know if there is a way to do this (yet)
> And also I want to put few
> properties of mine in a way the squence of these properties are maintinated
> in manifest. My observation here is sqence is altered.
I dont believe that code should depend on the order; its part of the
manifest specification. We'd only be encouraging bad practices if enabled.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org
Ant Jar doubt
Posted by Raja Nagendra Kumar <Na...@erasmic.com>.
Hi,
When ever we jar I see in the manifest 'Ant-Version: Apache Ant 1.6.2' this
line. Could any one tell me how to avoid this. And also I want to put few
properties of mine in a way the squence of these properties are maintinated
in manifest. My observation here is sqence is altered.
Thank you in advance
Regards,
Nagendra
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org
Re: regression in handling of failures
Posted by Steve Loughran <st...@apache.org>.
Stefan Bodewig wrote:
> On Tue, 12 Apr 2005, Kev Jackson <ke...@it.fts-vn.com> wrote:
>
>
>>Looks like it was there in Ant 1.5 final (Java.run()), but now it's
>>missing
>
>
> I still think it will get added somewhere up-stream, I may be wrong.
>
> Steve, is there a location when your build fails?
>
nope. try it yourself
<java classname="nonexistent" />
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org
Re: regression in handling of failures
Posted by Stefan Bodewig <bo...@apache.org>.
On Tue, 12 Apr 2005, Kev Jackson <ke...@it.fts-vn.com> wrote:
> Looks like it was there in Ant 1.5 final (Java.run()), but now it's
> missing
I still think it will get added somewhere up-stream, I may be wrong.
Steve, is there a location when your build fails?
Stefan
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org
Re: regression in handling of failures
Posted by Kev Jackson <ke...@it.fts-vn.com>.
Looks like it was there in Ant 1.5 final (Java.run()), but now it's missing
Here's a patch to fix this.
Kev
>
> I have it on reliable authority (chapter 5 of java development with
> ant), that Ant1.5 would fail with a location error when you tried to
> run <java> without a class on the classpath. But now I see a stack
> trace and not a location:
>
> [echo] running the diary program
> [java] Could not find d1.core.DiaryMain. Make sure you have it in
> your classpath
> [java] at
> org.apache.tools.ant.taskdefs.ExecuteJava.execute(ExecuteJava.java:178)
> [java] at org.apache.tools.ant.taskdefs.Java.run(Java.java:731)
> [java] at
> org.apache.tools.ant.taskdefs.Java.executeJava(Java.java:190)
> [java] at org.apache.tools.ant.taskdefs.Java.execute(Java.java:100)
> [java] at
> org.apache.tools.ant.UnknownElement.execute(UnknownElement.jav
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
> For additional commands, e-mail: dev-help@ant.apache.org
>