Problem with ant - failed to create task or type updateDatabase

Hi,

I’m currently trying to test LiquiBase 2.0 in an existing build environment using ant. I get the following error when my ant target tries to call “updateDatabase”:

$ ant update-databases
Buildfile: build.xml

update-prepare:
 [taskdef] Could not load definitions from resource scripts/liquibase/liquibase.properties. It could not be found.

update-databases:

BUILD FAILED
/myapp/scripts/build.xml:33: Problem: failed to create task or type updateDatabase
Cause: The name is undefined.
Action: Check the spelling.
Action: Check that any custom tasks/types have been declared.
Action: Check that any / declarations have taken place.

Total time: 0 seconds

It seems to me that the liquibase.jar file is not loaded, but I cant see why.

My build area has the following structure:
/myapp
 /scripts
 /liquibase
   lib/
     mysql-connector-java.jar
   liquibase.jar
   liquibase
   db.changelog.xml
   

I’ve got the following config:
#/myapp/build.xml (top level build.xml)

    ... ...

#/myapp/scripts/build.xml

                                                   

     
         
     

       basedir param not set. Run from your ant base dir.    database url not set    database.username not set    database.password not set

       <updateDatabase
               changeLogFile="${basedir}/scripts/liquibase/db.changelog.xml"
               driver=“com.mysql.jdbc.Driver”
               url="${database.url}"
               username="${database.username}"
               password="${database.password}"
               promptOnNonLocalDatabase=“false”
               dropFirst=“false”
               calsspathref="${lib.dir};${basedir}/scripts/liquibase"
       />

#/myapp/scripts/liquibase/liquibase.properties

    classpath: *.jar;lib/*.jar

Any input is most wellcome!

Cheers!

Have you tried the latest build from http://liquibase.org/ci/latest ?

Nathan

Thanks for the reply Nathan.

I’ve tested with the lastest release candidate with the same result. Looks like this is more of a Ant issue than a liquibase issue. It does not seem like Ant successfully loads the liquibase.jar file so that the updateDatabase task is available to Ant.

I’ve also tested putting the liquibase.jar file in ant’s lib (/usr/share/ant/lib) without any success.

Not sure how to proceed with this problem.

Cheers!

Has this issue been resolved. I am using the latest stable version of the liquibase jar and still see the issue. I have put the liquibase jar in ANT/lib. I still get the same error.

-Satish

It works fine for me in ant. I don’t add liquibase.jar to the ant/lib folder but instead use the classpathref attribute on taskdef to point to a classpath containing liquibase. 


I also use the same classpath with liquibase and my jdbcdriver in the classpathref attribute of the task, although I’m not sure if that is needed or not.


Nathan

Hi there, i am getting  same error? how did you fix this issue

 I am trying to use updateDatabase task and getting following error

taskdef A class needed by class liquibase.integration.ant.DropAllTask cannot be found: org/apache/tools/ant/Task

 using the classloader AntClassLoader[]

That error looks like it is caused by liquibase not being in ant’s classpath, or the classpath passed to taskdef.


Nathan

Hi,

I had the same problem but found a resolve. The issue was i wasn’t defining liquibasetasks.properties as a resource.

So failing code:
   
        <updateDatabase
            changeLogFile="${db.changelog.file}"
            driver="${database.driver}"
            url="${database.url}"
            username="${database.username}"
            password="${database.password}"
            classpathref=“antclasspath”
        />
   

Resolving code:
   
       
           
       
        <updateDatabase
            changeLogFile="${db.changelog.file}"
            driver="${database.driver}"
            url="${database.url}"
            username="${database.username}"
            password="${database.password}"
            classpathref=“antclasspath”
        />
   

Hope this is able to help someone out…