Discussion:
[Liquibase-user] New Topic: ant path problem
Liquibase Community Forum
2011-02-01 21:39:12 UTC
Permalink
A new topic, 'ant path problem', has been made on a board you are watching.

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

The text of the topic is shown below:

I am running up against a path issue with using liquibase and ant.

If I run ant from the directory where the build.xml is defined then everything runs correctly. But if I run ant from a different location and specify the build.xml file manually then the liquibase scripts can no longer locate the changeLogFile file.

So if I am in the directory /tmp and my "build.xml" file is in the directory "/tmp/liquibase" and I run "ant -f /tmp/liquibase/build.xml" I will get an error "/tmp/liquibase/build.xml:28: liquibase.exception.ChangeLogParseException: ora/update.xml does not exist". It appears that Liquibase is using the directory I run ant from rather than the directory where the build file is located as its base directory. It should take all of its directory references from where the build file is specified rather than from where the ant script is executed.

I can get around this problem by stating the entire path in the build.xml file but then it makes it so each developer using liquibase must have the exact same path structure or else I have the chance of a changeset being executed twice because of a differing file structure.


For repeatability here is my project structure and my build.xml file

Here is my file structure
/tmp/liquibase/build.xml
/tmp/liquibase/ora/update.xml
/tmp/liquibase/lib/liquibase.jar
/tmp/liquibase/lib/ojdbc.jar

My build.xml file looks like this

<project name="UPDATE" default="updatedb">
<property file="conf/build.properties"/>

<property name="liquibase.lib" value="ora/liquibase_lib" />

<path id="liquibase.classpath">
<fileset dir="lib">
<include name="*.jar" />
</fileset>
</path>

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

<target name="updatedb">
<!-- does the update -->
<updateDatabase
changeLogFile="ora/update.xml"
driver="oracle.jdbc.OracleDriver"
url="${sqlj.url}"
username="${sqlj.user}"
password="${sqlj.password}"
promptOnNonLocalDatabase="true"
dropFirst="false"
contexts="dev"
classpathref="liquibase.classpath"
/>
</target>
</project>

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.

Loading...