Skip to content

Instantly share code, notes, and snippets.

@rponte
Created May 18, 2011 18:19
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rponte/979167 to your computer and use it in GitHub Desktop.
Save rponte/979167 to your computer and use it in GitHub Desktop.
ant macrodef sample
<!-- Create migrate task -->
<macrodef name="migrate">
<attribute name="command" />
<attribute name="environment" />
<element name="extraarguments" optional="true" />
<sequential>
<echo>** Executing "migrate @{command}" on "@{environment}" environment **</echo>
<java classname="org.apache.ibatis.migration.Migrator"
failonerror="true" fork="true" classpathref="classpath">
<sysproperty key="file.encoding" value="UTF-8"/>
<arg value="@{command}" />
<arg value="--env=@{environment}" />
<extraarguments />
</java>
</sequential>
</macrodef>
<!-- Simula o comando: -->
<!-- $ migrate new <description> -->
<target name="migrate.new">
<input addproperty="description" message="Descricao da nova migration:"/>
<migrate command="new" environment="${environment}">
<extraarguments>
<arg value="${description}" />
</extraarguments>
</migrate>
</target>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment