ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mitja B." <i...@mitjab.com>
Subject Re: AW: Open and read file with ant and then copy
Date Mon, 10 Sep 2007 12:33:08 GMT
I use your idea but i still have small problem. I install Ant-Contrib Tasks
but still get this error. I little modify your code

OUTPUT =

c:\Projekti\test>ant opencopy
Buildfile: build.xml

opencopy:

BUILD FAILE:
c:\projekti\test\build.xml:19: The following error occurred while executing
this line: C:\projekti\test\build.xml:23: Warning: could not find file
c:\Projekti\test\${from} to copy

Total time: 0 seconds

:: line 19 is <ac:for
:: line 23 is <copy

CODE =

<target name="opencopy">
<taskdef resource="net/sf/antcontrib/antlib.xml"/>
<loadfile property="allfiles" srcFile="c:/Projekti/test/message.txt"/>
<ac:for list="${allfiles}" param="line">
<ac:sequential>
<ac:propertyregex property="from" input="@{srcFile}" regexp="(.*)=(.*)"
select="\1" override="true"/>
<ac:propertyregex property="to" input="@{srcFile}" regexp="(.*)=(.*)"
select="\2" override="true"/>
<copy file="${from}" tofile="${to}"/>
</ac:sequential>
</ac:for>
</target>

this is message.txt
/a/b/c.xml=/d/e/f.xml


--------- Original Message --------
From: Ant Users List <user@ant.apache.org>
To: user@ant.apache.org <user@ant.apache.org>
Subject: AW: Open and read file with ant and then copy
Date: 10/09/07 11:53

> Just an idea and not tested. Use '=' for separating source from target
name. Used AntContrib.
> 
> copy.txt
> --------
> /a/b/c.xml=/d/e/f.xml
> ....
> 
> 
> 
> &lt;loadfile property=&quot;allfiles&quot; file=&quot;copy.txt&quot;/&gt;
> &lt;ac:for list=&quot;${allfiles}&quot; param=&quot;line&quot;&gt;
>     &lt;sequential&gt;
>         &lt;ac:propertyregex property=&quot;from&quot;
input=&quot;@{file}&quot; regexp=&quot;(.*)=(.*)&quot; select=&quot;1&quot;
override=&quot;true&quot;/&gt;                   
>         &lt;ac:propertyregex property=&quot;to&quot;  
input=&quot;@{file}&quot; regexp=&quot;(.*)=(.*)&quot; select=&quot;2&quot;
override=&quot;true&quot;/&gt;
>         &lt;copy file=&quot;${from}&quot; tofile=&quot;${to}&quot;/&gt;
>     &lt;/&gt;
> &lt;/&gt;
> 
> 
> 
> Jan
> 
> 
> &gt;-----Urspr√ľngliche Nachricht-----
> &gt;Von: Mitja B. [mailto:info@mitjab.com] 
> &gt;Gesendet: Montag, 10. September 2007 10:32
> &gt;An: Materne, Jan (RZF)
> &gt;Betreff: Re: AW: Open and read file with ant and then copy
> &gt;
> &gt;We have few different customers which all have uniq files to 
> &gt;copy. We want
> &gt;that if is possible ant read project.txt file and in it are 
> &gt;all relative
> &gt;paths for files to copy, then ant will copy all this files.
> &gt;
> &gt;Is this possible?
> &gt;
> &gt;
> &gt;--------- Original Message --------
> &gt;From: Jan.Materne@rzf.fin-nrw.de
> &gt;To: user@ant.apache.org &lt;user@ant.apache.org&gt;, info@mitjab.com
> &gt;&lt;info@mitjab.com&gt;
> &gt;Subject: AW: Open and read file with ant and then copy
> &gt;Date: 10/09/07 09:49
> &gt;
> &gt;&gt; What is the use case for using this project.txt?
> &gt;&gt; 
> &gt;&gt; Usually you copy a bunch of files with &amp;lt;copy
todir&amp;gt;&amp;lt;fileset
> &gt;dir=&amp;quot;from&amp;quot;&amp;gt;
> &gt;&gt; 
> &gt;&gt; 
> &gt;&gt; Jan 
> &gt;&gt; 
> &gt;&gt; &amp;gt;-----Urspr√ľngliche Nachricht-----
> &gt;&gt; &amp;gt;Von: Mitja B. [mailto:info@mitjab.com] 
> &gt;&gt; &amp;gt;Gesendet: Montag, 10. September 2007 09:29
> &gt;&gt; &amp;gt;An: user@ant.apache.org
> &gt;&gt; &amp;gt;Betreff: Open and read file with ant and then copy
> &gt;&gt; &amp;gt;
> &gt;&gt; &amp;gt;I have big problem. I search but can not find and
solution.
> &gt;&gt; &amp;gt;
> &gt;&gt; &amp;gt;We want to open some file, for example project.txt
> &gt;&gt; &amp;gt;
> &gt;&gt; &amp;gt;in it we will have content like this
> &gt;&gt; &amp;gt;
> &gt;&gt; &amp;gt;instmmconnection.xml projrtuconnection.xml
> &gt;&gt; &amp;gt;
> &gt;&gt; &amp;gt;we want now that ant read this file and copy
connectiion.xml 
> &gt;&gt; &amp;gt;from instmm
> &gt;&gt; &amp;gt;directory to projrtu directory
> &gt;&gt; &amp;gt;
> &gt;&gt; &amp;gt;How can we do this with ant, or even better is this
possible?
> &gt;&gt; &amp;gt;
> &gt;&gt; &amp;gt;Thx
> &gt;&gt; &amp;gt;
> &gt;&gt; &amp;gt;________________________________________________
> &gt;&gt; &amp;gt;Message sent using UebiMiau 2.7.10
> &gt;&gt; &amp;gt;
> &gt;&gt; &amp;gt;
> &gt;&gt; &amp;gt;
> &gt;&gt; 
> &gt;&amp;gt;-----------------------------------------------------------
> &gt;----------
> &gt;&gt; &amp;gt;To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> &gt;&gt; &amp;gt;For additional commands, e-mail: user-help@ant.apache.org
> &gt;&gt; &amp;gt;
> &gt;&gt; &amp;gt;
> &gt;&gt; 
> &gt;&gt; 
> &gt;
> &gt;________________________________________________
> &gt;Message sent using UebiMiau 2.7.10
> &gt;
> &gt;
> &gt;
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
> 
> 
> 

________________________________________________
Message sent using UebiMiau 2.7.10



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


Mime
View raw message