2 consecutives ANT calls

  • Patrice Laplaige


    When calling 2 times the ANT schemacrawler task on 2 different hsqldb databases, the job is done (2 files are created) but all remaining ant tasks that are after the second call are not executed, like an echo for example.

    Also, it seems that the lock file (.lck) of the hsql database is still present after the schemacrawler task. I suppose that a clean db closing is not performed. A test of 2 consecutive calls to the same schemacrawler task (same db) fails.

    My config : Eclipse 3.7.2, ANT 1.9.0, JAVA 1.7.0_03, Hsqldb 2.2.5

    Any suggestion ? Thanks in advance.

  • Sualeh Fatehi

    Sualeh Fatehi - 2013-08-28

    Patrice, let me take a look, and get back to you.

  • Sualeh Fatehi

    Sualeh Fatehi - 2013-08-29

    Patrice, which version of SchemaCrawler are you using, and what operating system? I cannot reproduce your problem. If you look at the SchemaCrawler code, you will see that it uses Java 7 try-with-resources syntax for every connection that is opened. I have carefully checked that no connection is left open.

  • Patrice Laplaige

    Sorry for the delay... I use version 10.4 of schemaCrawler on windows XP.
    Hereafter a demo of how I use it (normally with not empty databases), call target "start" :

    <project name="schemaCrawler" default="start">
        <property name="path.root" location="${basedir}/.."/>
        <property name="path.database" location="${path.root}\tests\database"/>
        <property name="path.database.db1" location="${path.database}\hsqldbdb1"/>
      <property name="path.database.db2" location="${path.database}\hsqldbdb2"/>
        <property name="exportFileName" value="dbExport.txt"/>
        <property name="db.name" value="SHAPERDB"/>
        <property name="url.db1" value="jdbc:hsqldb:file:${path.database.db1}\${db.name}" />
        <property name="url.db2" value="jdbc:hsqldb:file:${path.database.db2}\${db.name}" />
        <property name="jdbc.driver" value="org.hsqldb.jdbcDriver"/>
      <!-- Define the classpath to the database driver and schemacrawler -->
       <path id="schemacrawlerClasspath">
         <fileset dir="d:\Wrk\Eclipse\ExternalLibraries\shemaCrawler\schemacrawler-hsqldb-10.4\lib">
           <include name="*.jar"/>
      <!-- Define an ant task that uses the <schemacrawler> macro -->
        <!-- Macro exporting a shema into a file, 2 parameters : url and filename. Available SchemaCrawler commands are : schema, details, count, dump -->
        <target name="exportSchema">
          <echo message="Export schema at url ${url} in file ${filename}"/>
            <sleep seconds="2"/>
          <echo message="SchemaCrawler output is in ${filename}"/>
          <replace file="${filename}" token="${url}" value=""/>
      <target name="exportSchema1">
        <antcall target="exportSchema" inheritall="false">
          <param name="url" value="${url.db1}"/>
          <param name="filename" value="${path.database.db1}\${exportFileName}"/>
      <target name="exportSchema2">
        <antcall target="exportSchema" inheritall="false">
          <param name="url" value="${url.db2}"/>
          <param name="filename" value="${path.database.db2}\${exportFileName}"/>
      <target name="start" depends="exportSchema1,exportSchema2"/>

    And the result in the console :

         [echo] Export schema at url jdbc:hsqldb:file:D:\Wrk\Eclipse\workspace\Shaper\tests\database\hsqldbdb1\SHAPERDB in file D:\Wrk\Eclipse\workspace\Shaper\tests\database\hsqldbdb1\dbExport.txt
         [echo] SchemaCrawler output is in D:\Wrk\Eclipse\workspace\Shaper\tests\database\hsqldbdb1\dbExport.txt
         [echo] Export schema at url jdbc:hsqldb:file:D:\Wrk\Eclipse\workspace\Shaper\tests\database\hsqldbdb2\SHAPERDB in file D:\Wrk\Eclipse\workspace\Shaper\tests\database\hsqldbdb2\dbExport.txt

    => I cannot see the last echo and the lock file of the databases are still there
    I will have a look on how to have a different resource syntax for both connections...

  • Sualeh Fatehi

    Sualeh Fatehi - 2013-09-28


    What happens if you change the order of two databases in your ant file? That is,

    <target name="start" depends="exportSchema2,exportSchema1"/>


    Last edit: Sualeh Fatehi 2013-09-28
  • Patrice Laplaige


    The same thing happens, the databases are automatically created whatever the order but the second echo "SchemaCrawler output is in ${filename}" is never seen in the eclipse console.
    I also tried to change the hsqldb driver version from 2.3.0 to 2.2.9, tried to change the way shemacrawler is called, same thing... Also if you add an echo in the target "start", it will never be seen in the eclipse console, strange & annoying. The fact that the lock file is not deleted does not disturb me, I just inform you. However the loss of next messages in the eclipse console is my problem.


  • Patrice Laplaige

    Hi Sualeh,

    Perhaps there is a link with my problem :
    I also tested the ant "config" parameter to try to hide names of indexes. (idem as -portable_names in command line). I added this parameter : "config="${path.database}\schemacrawler.config.properties", created the config file and put inside the entire example you give with that change : "schemacrawler.format.hide_index_names=true". No change in the exported result, I tested many options.

    Does it works for you ?
    Does my last chance is to test to call directly java instead of trying using ant task?

    Thanks for your advices

  • Sualeh Fatehi

    Sualeh Fatehi - 2013-09-30

    Patrice, let us take this offline. Please email me at sualeh@hotmail.com. Thanks.


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks