Custom ANT Task not working in <for> loop

leeand00 <[email protected]> Thu, 20 Aug 2009 11:45:25 -0700 (PDT)
Newsgroups gmane.comp.java.ant-contrib.devel
Message-ID <[email protected]>
--===============5014239033717371618==
Content-Type: multipart/alternative; 
	boundary="----=_Part_65258_650337.1250793925128"

------=_Part_65258_650337.1250793925128
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit


Hello, 

I've written a custom ANT task for purposes of returning an associated value
from a file (that works almost like a hash map):


"I11_home.htm",                   "1683"
"I11_office_catalog.htm",       "1546"
"I11_mixed_catalog.htm",       "1673"
"I11_approve.htm",                "527"
"I11_reports.htm",                 "1547"
"I11_history.htm",                 "1548"
"I11_settings.htm",               "1549"
"I11_pricing.htm",                 "1550"
"I11_edit_imprint.htm",          "1551"
"I11_review_imprint.htm",       "1552"
"I11_checkout.htm",              "1671"
"I11_payment.htm",               "1567"
"I11_confirm.htm",                "1556"



The left hand column above contains what the file is currently named.  

The right hand column above contains what I would like to rename the file
to. 






Now it's my Custom ANT task's job to take an argument of the file name, and
return the corresponding file name for ANT to rename it to.

In my ANT build.xml file I have 



	&lt;echo&gt;DL List: ${csvDownloadList}&lt;/echo&gt;
        &lt;for list="${csvDownloadList}"
                 param="letter"&gt;
             &lt;sequential&gt;
                
                &lt;!-- Figureout what the file needs to be renamed to
--&gt;
                &lt;XebraCodeRelate fileText="${file.configs.txt}"
forFile="@{letter}" property="renameTo" /&gt;
                &lt;echo&gt; -------------------------------------
&lt;/echo&gt;
                &lt;echo&gt; Renaming file @{letter} to
${renameTo}&lt;/echo&gt;
                &lt;echo&gt; -------------------------------------
&lt;/echo&gt;
                
                
                &lt;move file="@{letter}" tofile="${renameTo}" /&gt;

                &lt;var name="renameTo" unset="true"/&gt;
                
             &lt;/sequential&gt;
        &lt;/for&gt;

 


Note that ${csvDownloadList} looks like this: 

1683,1546,1673,527,1547,1548,1549,1550,1551,1552,1671,1567,1556

However for some reason my &lt;for&gt; loop craps out after renaming one
file.  It seems to have something to do with my Custom ANT Task not being
able to work within a  &lt;for&gt; loop.

Why is this?  Is there some other class besides Task I need to extend to
make this work?

-----
Thank you,

&nbsp;&nbsp;&nbsp;Andrew J. Leer -  http://leeand00.tiddlyspot.com/ My Blog 
-- 
View this message in context: http://www.nabble.com/Custom-ANT-Task-not-working-in-%3Cfor%3E-loop-tp25067661p25067661.html
Sent from the Ant Contrib mailing list archive at Nabble.com.

------=_Part_65258_650337.1250793925128
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit


Hello, 

I've written a custom ANT task for purposes of returning an associated value from a file (that works almost like a hash map):
<pre>
<blockquote>
"I11_home.htm",                   "1683"
"I11_office_catalog.htm",       "1546"
"I11_mixed_catalog.htm",       "1673"
"I11_approve.htm",                "527"
"I11_reports.htm",                 "1547"
"I11_history.htm",                 "1548"
"I11_settings.htm",               "1549"
"I11_pricing.htm",                 "1550"
"I11_edit_imprint.htm",          "1551"
"I11_review_imprint.htm",       "1552"
"I11_checkout.htm",              "1671"
"I11_payment.htm",               "1567"
"I11_confirm.htm",                "1556"
</blockquote>
</pre>

The left hand column above contains what the file is currently named.  <br />
The right hand column above contains what I would like to rename the file to. <br />
<br />
<br />
<br />


Now it's my Custom ANT task's job to take an argument of the file name, and return the corresponding file name for ANT to rename it to.

In my ANT <b>build.xml</b> file I have 

<pre>
<blockquote>
	&lt;echo&gt;DL List: ${csvDownloadList}&lt;/echo&gt;
        &lt;for list="${csvDownloadList}"
                 param="letter"&gt;
             &lt;sequential&gt;
                
                &lt;!-- Figureout what the file needs to be renamed to --&gt;
                &lt;XebraCodeRelate fileText="${file.configs.txt}" forFile="@{letter}" property="renameTo" /&gt;
                &lt;echo&gt; ------------------------------------- &lt;/echo&gt;
                &lt;echo&gt; Renaming file @{letter} to ${renameTo}&lt;/echo&gt;
                &lt;echo&gt; ------------------------------------- &lt;/echo&gt;
                
                
                &lt;move file="@{letter}" tofile="${renameTo}" /&gt;

                &lt;var name="renameTo" unset="true"/&gt;
                
             &lt;/sequential&gt;
        &lt;/for&gt;
</blockquote>
 </pre>

Note that ${csvDownloadList} looks like this: <br /><br />
1683,1546,1673,527,1547,1548,1549,1550,1551,1552,1671,1567,1556
<br /><br />
However for some reason my &lt;for&gt; loop craps out after renaming one file.  It seems to have something to do with my Custom ANT Task not being able to work within a  &lt;for&gt; loop.

Why is this?  Is there some other class besides Task I need to extend to make this work?<div class="signature">Thank you,<br />
&nbsp;&nbsp;&nbsp;Andrew J. Leer - <a href="http://leeand00.tiddlyspot.com/" target="_top" rel="nofollow">My Blog</a></div>
<br><hr align="left" width="300">
View this message in context: <a href="http://www.nabble.com/Custom-ANT-Task-not-working-in-%3Cfor%3E-loop-tp25067661p25067661.html">Custom ANT Task not working in <for> loop</a><br>
Sent from the <a href="http://www.nabble.com/Ant-Contrib-f2364.html">Ant Contrib mailing list archive</a> at Nabble.com.<br>

------=_Part_65258_650337.1250793925128--



--===============5014239033717371618==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
--===============5014239033717371618==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Ant-contrib-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ant-contrib-developers

--===============5014239033717371618==--