You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by I am Who i am <ra...@gmail.com> on 2008/09/11 22:04:07 UTC

exec task with *

Hi All

I'm trying to zip one folder, with some specific files from it as part of
build like
  <exec dir="/home/${usr}/doc" executable="zip" failonerror="true">
      <arg line="-ll doc.jar *.properties">
  </arg>

but this throws error zip warning: name not matched: *.properties

so i tried to use <shellscript> task from ant-contrib

<shellscript shell="bash" dir="/home/${usr}/doc">

cd /home/${usr}/doc

zip -ll doc.jar *.properties

</shellscript>

This works, but i have problem with this, when there is some valid error
lets say ${usr} directory doesn't exist, this task is no failing. Means
build is not failing at that position, it just keeps continue to next target
on the build.xml

Any one has any idea on how to make sure to have failonerror=true for this??

Re: exec task with *

Posted by Christoph Dittberner <C....@digitec.de>.
Hi,

failonerror is supported ... I use this in my shellscriptlets. But your 
commandline :

cd /home/${usr}/doc 
zip -ll doc.jar *.properties

ignores the errorcode. Therefore I wrote your two commands in one row concatenated with the *&&*. If this doesn't work try something like 

<shellscript shell="bash" dir="/home/${usr}/doc" failonerror="true">
cd /home/${usr}/doc || exit 0
zip -ll doc.jar *.properties
</shellscript>

You have to use "failonerror=true" to get the errorcode of the schellscriptlet reported into ant.

BTW like Glenn said, you should instead use the appropriate ANT-task to get the work done.

<zip destfile="/home/${usr}/doc/doc.jar" basedir="/home/${usr}/doc" includes="**/*.properties" level="1" duplicate="preserve"/>




I am Who i am schrieb:
> Thanks for your reply,
>
> I think failonerror is not supported, coz i tried that already
>
> On Thu, Sep 11, 2008 at 4:30 PM, Christoph Dittberner <
> C.Dittberner@digitec.de> wrote:
>
>   
>> hi you are who you are,
>>
>> I guess this problem occurs because YOU (your script) ignores the errorcode
>> of the cd-command.
>>
>> Try something like that:
>>
>> <shellscript shell="bash" dir="/home/${usr}/doc" failonerror="true">
>> cd /home/${usr}/doc && zip -ll doc.jar *.properties
>> </shellscript>
>>
>>
>> I am Who i am schrieb:
>>
>> Hi All
>>     
>>> I'm trying to zip one folder, with some specific files from it as part of
>>> build like
>>>  <exec dir="/home/${usr}/doc" executable="zip" failonerror="true">
>>>      <arg line="-ll doc.jar *.properties">
>>>  </arg>
>>>
>>> but this throws error zip warning: name not matched: *.properties
>>>
>>> so i tried to use <shellscript> task from ant-contrib
>>>
>>> <shellscript shell="bash" dir="/home/${usr}/doc">
>>>
>>> cd /home/${usr}/doc
>>>
>>> zip -ll doc.jar *.properties
>>>
>>> </shellscript>
>>>
>>> This works, but i have problem with this, when there is some valid error
>>> lets say ${usr} directory doesn't exist, this task is no failing. Means
>>> build is not failing at that position, it just keeps continue to next
>>> target
>>> on the build.xml
>>>
>>> Any one has any idea on how to make sure to have failonerror=true for
>>> this??
>>>
>>>
>>>
>>>       
>> --
>> Mit freundlichen Grüßen
>>
>> Christoph Dittberner
>> Dipl. Inf.
>>
>> digitec GmbH
>> Amsinckstraße 57
>> 20097 Hamburg
>>
>> Tel. +49 40 23776-156
>> Fax  +49 40 23776-200
>> _________________________________________________________________________
>>
>> www.digitec.de
>> digitec GmbH EDV-Beratung, Soft- und Hardware
>> Sitz Hamburg - HRB 28818, Amtsgericht Hamburg - Steuer-Nr. 2279101874
>> Geschäftsführer Klaus Bredow, Hans-Joachim Hänel, Hans-Jürgen Joost
>>
>> WICHTIGER HINWEIS
>> Die Kommunikation mit digitec GmbH per Email dient nur dem Zweck der
>> schnellen Information. Rechtsverbindliche Absprachen kommen über dieses
>> Medium nicht zustande !
>>
>> IMPORTANT NOTICE
>> Communication with digitec GmbH via email is for quick information purposes
>> only. This medium is not to be used for the  exchange of legally binding
>> statements !
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>> For additional commands, e-mail: user-help@ant.apache.org
>>
>>
>>     
>
>   

-- 
Mit freundlichen Grüßen

Christoph Dittberner
Dipl. Inf.

digitec GmbH
Amsinckstraße 57
20097 Hamburg

Tel. +49 40 23776-156
Fax  +49 40 23776-200
_________________________________________________________________________

www.digitec.de
digitec GmbH EDV-Beratung, Soft- und Hardware
Sitz Hamburg - HRB 28818, Amtsgericht Hamburg - Steuer-Nr. 2279101874
Geschäftsführer Klaus Bredow, Hans-Joachim Hänel, Hans-Jürgen Joost

WICHTIGER HINWEIS
Die Kommunikation mit digitec GmbH per Email dient nur dem Zweck der
schnellen Information. Rechtsverbindliche Absprachen kommen über dieses 
Medium nicht zustande !

IMPORTANT NOTICE
Communication with digitec GmbH via email is for quick information 
purposes only. This medium is not to be used for the  exchange of 
legally binding statements !


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: exec task with *

Posted by I am Who i am <ra...@gmail.com>.
Thanks for your reply,

I think failonerror is not supported, coz i tried that already

On Thu, Sep 11, 2008 at 4:30 PM, Christoph Dittberner <
C.Dittberner@digitec.de> wrote:

> hi you are who you are,
>
> I guess this problem occurs because YOU (your script) ignores the errorcode
> of the cd-command.
>
> Try something like that:
>
> <shellscript shell="bash" dir="/home/${usr}/doc" failonerror="true">
> cd /home/${usr}/doc && zip -ll doc.jar *.properties
> </shellscript>
>
>
> I am Who i am schrieb:
>
> Hi All
>>
>> I'm trying to zip one folder, with some specific files from it as part of
>> build like
>>  <exec dir="/home/${usr}/doc" executable="zip" failonerror="true">
>>      <arg line="-ll doc.jar *.properties">
>>  </arg>
>>
>> but this throws error zip warning: name not matched: *.properties
>>
>> so i tried to use <shellscript> task from ant-contrib
>>
>> <shellscript shell="bash" dir="/home/${usr}/doc">
>>
>> cd /home/${usr}/doc
>>
>> zip -ll doc.jar *.properties
>>
>> </shellscript>
>>
>> This works, but i have problem with this, when there is some valid error
>> lets say ${usr} directory doesn't exist, this task is no failing. Means
>> build is not failing at that position, it just keeps continue to next
>> target
>> on the build.xml
>>
>> Any one has any idea on how to make sure to have failonerror=true for
>> this??
>>
>>
>>
>
> --
> Mit freundlichen Grüßen
>
> Christoph Dittberner
> Dipl. Inf.
>
> digitec GmbH
> Amsinckstraße 57
> 20097 Hamburg
>
> Tel. +49 40 23776-156
> Fax  +49 40 23776-200
> _________________________________________________________________________
>
> www.digitec.de
> digitec GmbH EDV-Beratung, Soft- und Hardware
> Sitz Hamburg - HRB 28818, Amtsgericht Hamburg - Steuer-Nr. 2279101874
> Geschäftsführer Klaus Bredow, Hans-Joachim Hänel, Hans-Jürgen Joost
>
> WICHTIGER HINWEIS
> Die Kommunikation mit digitec GmbH per Email dient nur dem Zweck der
> schnellen Information. Rechtsverbindliche Absprachen kommen über dieses
> Medium nicht zustande !
>
> IMPORTANT NOTICE
> Communication with digitec GmbH via email is for quick information purposes
> only. This medium is not to be used for the  exchange of legally binding
> statements !
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>

Re: exec task with *

Posted by Christoph Dittberner <C....@digitec.de>.
hi you are who you are,

I guess this problem occurs because YOU (your script) ignores the 
errorcode of the cd-command.

Try something like that:

<shellscript shell="bash" dir="/home/${usr}/doc" failonerror="true">
cd /home/${usr}/doc && zip -ll doc.jar *.properties
</shellscript>


I am Who i am schrieb:
> Hi All
>
> I'm trying to zip one folder, with some specific files from it as part of
> build like
>   <exec dir="/home/${usr}/doc" executable="zip" failonerror="true">
>       <arg line="-ll doc.jar *.properties">
>   </arg>
>
> but this throws error zip warning: name not matched: *.properties
>
> so i tried to use <shellscript> task from ant-contrib
>
> <shellscript shell="bash" dir="/home/${usr}/doc">
>
> cd /home/${usr}/doc
>
> zip -ll doc.jar *.properties
>
> </shellscript>
>
> This works, but i have problem with this, when there is some valid error
> lets say ${usr} directory doesn't exist, this task is no failing. Means
> build is not failing at that position, it just keeps continue to next target
> on the build.xml
>
> Any one has any idea on how to make sure to have failonerror=true for this??
>
>   

-- 
Mit freundlichen Grüßen

Christoph Dittberner
Dipl. Inf.

digitec GmbH
Amsinckstraße 57
20097 Hamburg

Tel. +49 40 23776-156
Fax  +49 40 23776-200
_________________________________________________________________________

www.digitec.de
digitec GmbH EDV-Beratung, Soft- und Hardware
Sitz Hamburg - HRB 28818, Amtsgericht Hamburg - Steuer-Nr. 2279101874
Geschäftsführer Klaus Bredow, Hans-Joachim Hänel, Hans-Jürgen Joost

WICHTIGER HINWEIS
Die Kommunikation mit digitec GmbH per Email dient nur dem Zweck der
schnellen Information. Rechtsverbindliche Absprachen kommen über dieses 
Medium nicht zustande !

IMPORTANT NOTICE
Communication with digitec GmbH via email is for quick information 
purposes only. This medium is not to be used for the  exchange of 
legally binding statements !


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: exec task with *

Posted by glenn opdycke-hansen <gl...@gmail.com>.
Do you intent to create a zip or a jar file?
What is the value of ${usr}?
I suggest that the script be written to use the appropriate task,
either <jar> or <zip>

For example,
<echo>usr = ${usr}</echo>
<jar destfile="doc.jar"
       basedir="/home/${usr}/doc"
       includes="*.properties"
  />

--glenn

On Thu, Sep 11, 2008 at 3:04 PM, I am Who i am <ra...@gmail.com> wrote:
> Hi All
>
> I'm trying to zip one folder, with some specific files from it as part of
> build like
>  <exec dir="/home/${usr}/doc" executable="zip" failonerror="true">
>      <arg line="-ll doc.jar *.properties">
>  </arg>
>
> but this throws error zip warning: name not matched: *.properties
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org