ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rhino" <>
Subject Re: Displaying the value in a Java class?
Date Fri, 10 Feb 2006 21:52:58 GMT

I've _nearly_ got what I want but I'm not quite clear on how to change it to 
get _exactly_ what I want.

First of all, I understand your suggestion much better now and have it 
working 95%. This is my task:
 <loadfile srcfile="${resume.src}\${resume.pkg}\" 
   <containsRegex flags="m" pattern="^[\s]*public static final 
DESIRED_EMPLOYMENT_HISTORY_FORMAT[\s]*=[\s]*([^;]+);[\s]*$" replace="\1"/>
<echoproperties prefix="DESIRED"/>
echoproperties gives me:DESIRED_EMPLOYMENT_HISTORY_FORMAT=EmploymentHistoryFormats.LIST_FORMAT\r\nThat
would be perfect if it weren't for the '\r\n' at the end. Even still,it may be good enough
for my purposes. If you could tell me how to removethe carriage return and linefeed from the
end of the property, I'd love toknow. I'm afraid I'm very slow with REGEX patterns; I've tried
severalchanges to the pattern involving adding '\r\n' and '\s' but nothing works:rather than
getting the result with the \r\n, I get no result at all so I'mobviously messing up the match.But
that's the small problem. The far bigger problem is that I'm havingtrouble displaying the
value. I am trying to do it in an AntMenu via thistask: <antmenu title="Verify Employment
History Format"  stylesheet="${resume.xml.dir}\"  image="${resume.xml.dir}\">
 <label>The current value of the D
 <label>When it does, press the Proceed button.</label>  <label>If you want
to stop the build, press the Abort button.</label>  <link label="Proceed" target="jar"/>
 <link label="Abort" target="abort"/> </antmenu>Unfortunately, instead of displaying
I realize that you have nothing to do with AntMenu but perhaps you cansuggest another way
to display the value of the property, using somedifferent task? I could always display the
value in one task and use theAntForm to give the option to proceed or abort.We're really getting
close to having this work but I need just a little morehelp to get the rest of the way.--Rhino-----
Original Message -----From: "Matt Benson" <>To: "Ant Users List"
<>Sent: Friday, Fe
 bruary 10, 2006 12:26 PMSubject: Re: Displaying the value in a Java class?> --- Rhino
<> wrote:>> ----- Original Message ----->> From: "Matt
Benson" <>>> > --- Rhino <> wrote:>
[SNIP]>> >> other types) but the>> >> constant I am trying to read
is defined as>> follows:>> >>>> >>     public static final EmploymentHistoryFormats>>
>>>> >> EmploymentHistoryFormats is an enum, not a>> String.>>
>>>> >> Is there any way to coax this filter to tell me>> that>>
>> the current value of>> >> DESIRED_EMPLOYMENT_HISTORY_FORMAT is LIST_FORMAT?>>
>> That's all I really want>> >> to know to get my build.xml working 100%.>>
>>>> >> If not, is there any other way to get this>> >> information?>>
>>> > filter the Java file w/ regex looking for>> >>> > "^[\s]*public
static final>> EmploymentHistoryFormats>> >>>> DESIRED_EMPLOYMENT_HISTORY_FORMAT[\s]*=[\s]
 *([^;]+);[\s]*$">> >>> > and replace w/ "\1"?>> >>> Your
suggestion is a bit cryptic for me to follow>> completely. Are you saying>> I
should use a ContainsRegex filter but still within>> LoadProperties? Or are>>
you proposing that I use LoadFiles and the .java>> file instead of the>> ClassConstants
filter?>> Basically you want to display the value to the user,> right?  Then just
use <loadfile> with a <containsregex> flags="m"> filter... the regex I supplied
above> included a parenthetically-delimited "group" (I> believe is the term in regex
parlance) that included> the value.  When you specify "\1" as the replacement,> only
the portion of the input data that matched the> first (\1) group in the regex will come
through the> filter.  You could also move the parentheses forward> to pull the name
of the constant as well, and save> yourself a little more typing in the buildfile.  But>
you may want to give that as "Desired Employment> History Format", who knows?  The end
result i
 s that> you can load just that value (e.g. FOO) or D_E_H_F=FOO> in a property, which
you can then display to the user> as an <input> prompt or whatever.>> -Matt>>>>>
And why do you want to replace anything? I just want>> to know the value of>>
the constant, not change it. (Although, now that I>> think about it, it might>>
be neat to be able to let the user modify the value>> before doing the rest of>>
the build.... But I don't think that's what you're>> talking about, right?>>>>
-->> Rhino> [SNIP]>> __________________________________________________>
Do You Yahoo!?> Tired of spam?  Yahoo! Mail has the best spam protection around>>>
---------------------------------------------------------------------> To unsubscribe,
e-mail:> For additional commands, e-mail:>>>
--> No virus found in this incoming message.> Checked by AVG Free Edition.> Version:
7.1.375 / Virus Database: 267.15.5/256 - Release Date
 : 10/02/2006>>

No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.375 / Virus Database: 267.15.5/256 - Release Date: 10/02/2006

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message