私は Liquibase の 2.0.5 バージョンを使用して、データベースの移行をテストしています。現在、task asにchangeLogFile
属性を定義し、 asにを指定すると、ファイルが見つかりません。updateDatabase
<updateDatabase changeLogFile="${changeLogFile}"
"${changeLogFile}"
liquibase.properties
changeLogFile=com/db/master.changelog.xml
master.changelog.xml
Eclispe と ant スタンドアロンを使用して、ant タスクを開始しました。
したがって、次の修正を使用します${basedir}/**src**/
。
<updateDatabase changeLogFile="${basedir}/src/${changeLogFile}"
しかし、そのような汚い解決策がなければ、私はとても幸せです。
/bin-directory を使用して、XML ファイルへのクラスパスを指定しようとしています
<fileset dir="bin"> <include name="**/*.xml" /> </fileset>
しかし例外が多発したので、このブロックをコメントアウトしました。
私は何を間違えましたか?
liquibase.properties
ファイルには次が含まれます。
changeLogFile=com/db/master.changelog.xml
driver=org.h2.Driver
url=jdbc:h2:tcp://localhost/testhiberliq
username=sa
password=
#for diff between two databases
baseUrl=jdbc:h2:tcp://localhost/testhiberliq
baseUsername=sa
basePassword=
dropFirst=false
tag=version 1.4
outputFile=outputFile.xml
outputDiffFile=outputFile.txt
(NewFile1.xml
として使用build.xml
):
<?xml version="1.0" encoding="UTF-8"?>
<project name="liquibase-sample">
<property file="liquibase.properties" />
<path id="lib.path">
<fileset dir="lib">
<include name="**/*.jar" />
</fileset>
<!-- <fileset dir="bin">
<include name="**/*.xml" />
</fileset> -->
</path>
<taskdef resource="liquibasetasks.properties">
<classpath refid="lib.path" />
</taskdef>
<target name="update-database">
<!-- <taskdef name="updateDatabase"
classpathref="lib.path" />-->
<updateDatabase changeLogFile="${basedir}/src/${changeLogFile}" driver="${driver}" url="${url}" username="${username}" password="${password}" dropFirst="${dropfirst}" classpathref="lib.path" />
</target>
</project>
master.changelog.xml
:
<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog/1.9"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog/1.9
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-1.9.xsd">
<include file="changelog/included.changelog.xml" relativeToChangelogFile="true"/>
<include file="changelog/included2.changelog.xml" relativeToChangelogFile="true"/>
<include file="changelog/included3.changelog.xml" relativeToChangelogFile="true"/>
</databaseChangeLog>
そしてディレクトリツリー:
I:.
│ .classpath
│ .project
│ liquibase.properties
│ NewFile.xml
│ NewFile1.xml
│ outputFile.txt
│ outputFile.xml
│
├───.settings
│ org.eclipse.jdt.core.prefs
│
├───bin
│ │ hibernate.cfg.xml
│ │
│ ├───com
│ │ └───db
│ │ │ master.changelog.xml
│ │ │
│ │ └───changelog
│ │ included.changelog.xml
│ │ included2.changelog.xml
│ │ included3.changelog.xml
│ │
│ └───testproject
│ │ Main.class
│ │
│ └───database
│ │ DatabaseDAO.class
│ │
│ └───pojo
│ Users.class
│
├───lib
│ h2-1.3.168.jar
│ liquibase.jar
│
└───src
│ hibernate.cfg.xml
│
├───com
│ └───db
│ │ master.changelog.xml
│ │
│ └───changelog
│ included.changelog.xml
│ included2.changelog.xml
│ included3.changelog.xml
│
└───testproject
│ Main.java
│
└───database
│ DatabaseDAO.java
│
└───pojo
Users.java