ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <Jan.Mate...@rzf.fin-nrw.de>
Subject AW: creating a build file via another build file
Date Fri, 17 Aug 2007 11:58:13 GMT
You are embedding xml statements in <echo> and this is not allowed, you could use <echoxml>
instead.
But you have also a xml declaration in your echo
   <?xml version="1.0" encoding="UTF-8"?>
You could leave that or you have to use <echo> and encode the xml-charachter (<>&...).


I have a little perl script for masking - for my own need:
---8-<-------8-<-------8-<-------8-<-------8-<-------8-<-------8-<-------8-<----
use Win32::Clipboard;
$CLIP = Win32::Clipboard();

$clip = $CLIP->Get();

$clip =~ s/</&lt;/g;
$clip =~ s/>/&gt;/g;
$clip =~ s/"/&quot;/g;

$CLIP->Set($clip);
---8-<-------8-<-------8-<-------8-<-------8-<-------8-<-------8-<-------8-<----



So you would write something like

<echo file...>
    &lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
    &lt;project name=&quot;deploy&quot; default=&quot;start&quot; basedir=&quot;.&quot;&gt;

    &lt;target name=&quot;first&quot;&gt;
        &lt;exec executable=&quot;svn&quot;&gt;
            &lt;arg value=&quot;co&quot;/&gt;
                &lt;arg value=&quot;http://foo.com/svn/repos/&quot; /&gt;
            &lt;/exec&gt;
        &lt;/target&gt;
    &lt;/project&gt;
</echo>





Jan


-----Urspr√ľngliche Nachricht-----
Von: Vihan Pandey [mailto:vihanpandey@gmail.com] 
Gesendet: Freitag, 17. August 2007 13:29
An: user@ant.apache.org
Betreff: creating a build file via another build file

Hello,
        I have an a build file which generates another build file and then
executes it. I am creating the 2nd build file via an echo task to the file.
Something like this :

this is deploy.xml :

<?xml version="1.0" encoding="UTF-8"?>
<project name="xmlgen" default="init" basedir=".">

        <!-- Generate Deployment Script -->
        <target name="init">
        <echo file="build.xml.static-assets">
               <?xml version="1.0" encoding="UTF-8"?>
               <project name="deploy" default="start" basedir=".">

                       <target name="first">
                                          <exec executable="svn">
                                              <arg value="co"/>
                                              <arg value="
http://foo.com/svn/repos/" />
                                          </exec>
                       </target>
               </project>
        </echo>
        </target>

        <target name="execute">
          <exec executable="ant">
            <arg value="-f"/>
            <arg value="build.xml.static-assets"/>
            <arg value="start"/>
          </exec>
        </target>

</project>

and doing :

# anf -f deploy.xml init

should generate build.xml.static-assets and execute it via :

# ant -f build.xml.static-assets start

Currently executing the same gives me an error:

``The content of elements must consist of well-formed character data or
markup."

the build.xml.static-assets works stand alone but I want that file to be
generated through another ant script. Any suggestions?

Regards,

-vihan

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


Mime
View raw message