views:

610

answers:

2

I couldn't find any information about how to dump a MySQL database with an ant task.

Do I have to create my own task to do this?

ANT script ===generate==> myDataBase.sql
+2  A: 

You can use Exec task, which will start your script which will perform all actions necessary for dumping (or whatever).

Victor Sorokin
+9  A: 

Create a target that runs the "mysqldump" command like this:

<target name="dump-database">  
    <exec executable="mysqldump" output="database-dump.sql">  
        <arg value="--user=username" />  
        <arg value="--password=password" />  
        <arg value="--host=localhost" />  
        <arg value="--port=3306" />  
        <arg value="mydatabase" />  
    </exec>  
</target>

Now you can make the dump by executing ant dump-database

Tom van Zummeren