You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Rob Wilson <ne...@gmail.com> on 2007/11/08 19:51:19 UTC
Fail if file does not contains a string?
Is it possible to fail ant if a file does not contain a string?
Cheers,
Rob.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
Re: Fail if file does not contains a string?
Posted by Dominique Devienne <dd...@gmail.com>.
On 11/8/07, Rob Wilson <ne...@gmail.com> wrote:
> Is it possible to fail ant if a file does not contain a string?
<fail> <condition> <contains ... /> </fail> </condition>. --DD
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
RE: Returning a string as output from ANT task
Posted by "Agarkar, M (Milind)" <Mi...@rabobank.com>.
Thanks. That worked fine.
-----Original Message-----
From: Steve Loughran [mailto:stevel@apache.org]
Sent: 09 November 2007 10:55
To: Ant Users List
Subject: Re: Returning a string as output from ANT task
Agarkar, M (Milind) wrote:
> Hi,
>
> I am trying to write a custom ant task to accept two parameters and
> return a string as the output. I have tried the following
>
> 1. First I did use the java task with 'outputproperty' and that works
> well, returns the output string fine, however, it also returns a lot
> of log statements from the java class, so, instead of returning a
> string, it actually returns a stringbuffer. This is not good because
> the output string is referred to in other targets
what else does <java> output? It shouldnt return anything else except
that which your program prints
>
> 2. I tried writing in output file and that works perfect. Hoeever this
> is not the preferable solution for me.
if you write to a properties file, you can read it in later with
<property file>
>
> 3. I tried writing a custom ant task extending java task and tried to
> get the outputproperty, but it does not seem to work either. It does
> not return the outputproperty as the java task does.
if the code is all running in-process, just call
getProject().setNewProperty() with the property+value you want to set.
--
Steve Loughran http://www.1060.org/blogxter/publish/5
Author: Ant in Action http://antbook.org/
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
_____________________________________________________________
This email (including any attachments to it) is confidential, legally privileged, subject to copyright and is sent for the personal attention of the intended recipient only. If you have received this email in error, please advise us immediately and delete it. You are notified that disclosing, copying, distributing or taking any action in reliance on the contents of this information is strictly prohibited. Although we have taken reasonable precautions to ensure no viruses are present in this email, we cannot accept responsibility for any loss or damage arising from the viruses in this email or attachments. We exclude any liability for the content of this email, or for the consequences of any actions taken on the basis of the information provided in this email or its attachments, unless that information is subsequently confirmed in writing. If this email contains an offer, that should be considered as an invitation to treat.
_____________________________________________________________
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
Re: Returning a string as output from ANT task
Posted by Steve Loughran <st...@apache.org>.
Agarkar, M (Milind) wrote:
> Hi,
>
> I am trying to write a custom ant task to accept two parameters and
> return a string as the output. I have tried the following
>
> 1. First I did use the java task with 'outputproperty' and that works
> well, returns the output string fine, however, it also returns a lot of
> log statements from the java class, so, instead of returning a string,
> it actually returns a stringbuffer. This is not good because the output
> string is referred to in other targets
what else does <java> output? It shouldnt return anything else except
that which your program prints
>
> 2. I tried writing in output file and that works perfect. Hoeever this
> is not the preferable solution for me.
if you write to a properties file, you can read it in later with
<property file>
>
> 3. I tried writing a custom ant task extending java task and tried to
> get the outputproperty, but it does not seem to work either. It does not
> return the outputproperty as the java task does.
if the code is all running in-process, just call
getProject().setNewProperty() with the property+value you want to set.
--
Steve Loughran http://www.1060.org/blogxter/publish/5
Author: Ant in Action http://antbook.org/
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
Returning a string as output from ANT task
Posted by "Agarkar, M (Milind)" <Mi...@rabobank.com>.
Hi,
I am trying to write a custom ant task to accept two parameters and
return a string as the output. I have tried the following
1. First I did use the java task with 'outputproperty' and that works
well, returns the output string fine, however, it also returns a lot of
log statements from the java class, so, instead of returning a string,
it actually returns a stringbuffer. This is not good because the output
string is referred to in other targets
2. I tried writing in output file and that works perfect. Hoeever this
is not the preferable solution for me.
3. I tried writing a custom ant task extending java task and tried to
get the outputproperty, but it does not seem to work either. It does not
return the outputproperty as the java task does.
Can anybody point out the mistakes if any and ways to fix that ? OR ways
to acieve what I want ?
Thanks,
Milind
_____________________________________________________________
This email (including any attachments to it) is confidential, legally privileged, subject to copyright and is sent for the personal attention of the intended recipient only. If you have received this email in error, please advise us immediately and delete it. You are notified that disclosing, copying, distributing or taking any action in reliance on the contents of this information is strictly prohibited. Although we have taken reasonable precautions to ensure no viruses are present in this email, we cannot accept responsibility for any loss or damage arising from the viruses in this email or attachments. We exclude any liability for the content of this email, or for the consequences of any actions taken on the basis of the information provided in this email or its attachments, unless that information is subsequently confirmed in writing. If this email contains an offer, that should be considered as an invitation to treat.
_____________________________________________________________
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
RE: Fail if file does not contains a string?
Posted by Alec Fernandez <Al...@sas.com>.
You could use <loadfile> to read the file into a property then use the
contains <condition> in the condition task to check for the string.
If the file is big then you probably want to use a filterchain to subset
it.
-Alec
-----Original Message-----
From: Rob Wilson [mailto:netplay@gmail.com]
Sent: Thursday, November 08, 2007 1:51 PM
To: Ant Users List
Subject: Fail if file does not contains a string?
Is it possible to fail ant if a file does not contain a string?
Cheers,
Rob.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org For additional
commands, e-mail: user-help@ant.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org