Ant タスクを使用して MySQL データベースをダンプする方法に関する情報が見つかりませんでした。
これを行うには、独自のタスクを作成する必要がありますか?
ANT script ===generate==> myDataBase.sql
次のように「mysqldump」コマンドを実行するターゲットを作成します。
<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>
ant dump-databaseを実行してダンプを作成できるようになりました
ダンプに必要なすべてのアクションを実行するスクリプトを開始する Exec タスクを使用できます。
データ駆動型にしたい場合は、ant sql タスクを使用してこの男を試してください。
<macrodef name="sql-retrieve-table-schema">
<attribute name="schema-name"/>
<attribute name="table-name"/>
<attribute name="connection-url"/>
<attribute name="output-file"/>
<sequential>
<sql userid="username" url="@{connection-url}" classpathref="compile.classpath"
password="apassword" driver="com.mysql.jdbc.Driver" print="true" output="@{output-file}"
showheaders="false" showtrailers="false">
SHOW CREATE TABLE @{table-name};
</sql>
</sequential>
</macrodef>