A new topic, 'Ant won't load relative changeLogs when called from a different 
folder', has been made on a board you are watching.

You can see it at
http://liquibase.org/forum/index.php?topic=608.new#new

The text of the topic is shown below:

Hi,

Just setting up some simple ant tasks for unit testing my schema scripts - 
however there is an issue.

I have a top-level install changeLog in a folder 
src/repository/schema/install.xml that looks like this:

Code:
<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog";
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
        xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog 
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-2.0.xsd";>
    
        <includeAll path="install/tab/" />

</databaseChangeLog>

i.e. it contains an includeAll path relative to the location of the install.xml 
file. This runs fine if run from the command line in the src/repository/schema 
folder.


Now, my ant build.xml script is running from a folder one level up from this, 
i.e. src/repository. It contains the following basic task:

Code:
        <property name="schema.dir" location="schema" />

        <path id="lib.path">
                <pathelement location="${src.java.lib.dir}/liquibase.jar" />
                <pathelement location="${src.java.lib.dir}/jtds-1.2.5.jar" />
                <pathelement path="${schema.dir}" />
        </path>

        <taskdef resource="liquibasetasks.properties">
                <classpath refid="lib.path" />
        </taskdef>

        <target name="install-db" description="Updates DB">

                <updateDatabase changeLogFile="${install.changelog.file}"
                                driver="${database.driver}"
                                url="${database.url}"
                                username="${database.username}"
                                password="${database.password}"
                                defaultSchemaName="${database.username}"
                                promptOnNonLocalDatabase="false"
                                dropFirst="false"
                                classpathref="lib.path" />

        </target>

The problem I have is that when this is run, the includeAll tag fails with the 
following error:

Code:
install-db:
[updateDatabase] Jul 28, 2010 12:03:16 PM liquibase.logging.jvm.JavaUtilLogger 
info
[updateDatabase] INFO: Successfully acquired change log lock
[updateDatabase] Jul 28, 2010 12:03:17 PM liquibase.logging.jvm.JavaUtilLogger 
severe
[updateDatabase] SEVERE: Error thrown as a SAXException: Could not find 
directory or directory was empty for includeAll 'install/tab/'
[updateDatabase] org.xml.sax.SAXException: Could not find directory or 
directory was empty for includeAll 'install/tab/'
[updateDatabase]        at 
liquibase.parser.core.xml.XMLChangeLogSAXHandler.startElement(XMLChangeLogSAXHandler.java:219)

i.e. it can no longer determine the relative folder with respect to the initial 
install.xml file. To workaround this, I either have to use absolute pathnames 
(not ideal), or I have to move my build.xml to the same folder as the 
install.xml liquibase changeLogs. This also isn't ideal. Is there a way that I 
can get the ant task to correctly change to the databaseChangeLog folder prior 
to processing the changeLogs? I guess one solution would be to allow the 
various ant tasks to take a databaseChangeLogFolder/relativeBaseDir property or 
somesuch - and if defined, to change to this/resolve relative pathnames 
appropriately.

I'm happy to raise this as an issue if you think it worth resolving.

Many thanks.

Ben

Unsubscribe to new topics from this board by clicking here: 
http://liquibase.org/forum/index.php?action=notifyboard;board=1.0

Regards,
The Liquibase Community Forum Team.
------------------------------------------------------------------------------
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share 
of $1 Million in cash or HP Products. Visit us here for more details:
http://ad.doubleclick.net/clk;226879339;13503038;l?
http://clk.atdmt.com/CRS/go/247765532/direct/01/
_______________________________________________
Liquibase-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/liquibase-user

Reply via email to