An ant task for dbMonster is available. You may download it from sourceforge download site. It works with Ant 1.6.1 and probably some eariel versions.
Setup is quite easy. First of all get the latest dbmonster-core distribution
and unpack it somewhere, for example: /var/java/dbmonster-core.
Download dbmonster-ant.jar and copy it somewhere, for example: /var/java/dbmonster-ant
Add the following entries to your build.properties:
dbmonster.home=/var/java/dbmonster-core dbmonster.ant=/var/java/dbmonster-ant
Now we have to tell ant about new task:
<project name="dbmonster task example" default="gendb" basedir="."> <property file="build.properties"/> <!-- setup classpath --> <path id="dbmonster.classpath"> <fileset dir="${dbmonster.ant}"> <include name="*.jar"/> </fileset> <fileset dir="${dbmonster.home}"> <include name="**/*.jar"/> </fileset> </path> <taskdef name="dbmonster" classname="pl.kernelpanic.dbmonster.ant.DBMonsterTask" classpathref="dbmonster.classpath"> </taskdef> <target name="gendb"> <dbmonster config="${path.to.dbmonster.config.dir}/dbmonster.properties" prescript="${path.to.dbmonster.config.dir}/prescript.sql" postscript="${path.to.dbmonster.config.dir}/postscript.sql" verbose="true"> <fileset dir="${path.to.dbmonster.schemas.dir}"> <include name="*.xml"/> </fileset> </dbmonster> </target> </project>
If you have only ine schema file you can user schema attribute instead of
nested fileset.
That's it. Type 'ant' now to check your setup. If you want to see what
is going on inside type 'ant -v'.
Parameter | Description |
---|---|
config | path to configuration file |
schema | path to schema file if there is only one schema file, if there is more schema file a nested fileset should be used instead |
prescript | path to the SQL script (text file with one query per line) which will be executed just before dbMonster starts data generation process |
postscript | path to the SQL script (text file with one query per line) which will be executed immediately after dbMonster finished data generation process |
progressmonitor | Fully qualified class name of progress monitor class. |
verbose | if the progressmonitor parameter was not set a default progress
monitor can be used. To turn it on set verbose parameter to true |