dbdeploy的maven插件使用

Introduction

簡介html

The maven plugin is designed for people who use Apache Maven as a build tool.sql

maven插件的設計是被人們當初maven構建工具使用。數據庫

As well as this maven plugin, dbdeploy supports an ant task and a command line interface.apache

以及這個Maven插件,dbdeploy支持ant任務 和 命令行接口app

Usage

使用maven

The maven plugin was introduced in version 3.0M3. It is published to maven central.工具

Maven插件被引入到3.0m3版本中它發佈到Maven中心ui

Example pom.xml:this

 <build>
        <plugins>
            <plugin>
                <groupId>com.dbdeploy</groupId>
                <artifactId>maven-dbdeploy-plugin</artifactId>
                <version>3.0M3</version>

                <configuration>
                    <scriptdirectory>.</scriptdirectory>
                    <driver>org.hsqldb.jdbcDriver</driver>
                    <url>jdbc:hsqldb:file:db/testdb;shutdown=true</url>
                    <userid>sa</userid>
                    <password></password>
                    <dbms>hsql</dbms>
                    <delimiter>;</delimiter>
                    <delimiterType>row</delimiterType>
                </configuration>

                <dependencies>
                    <dependency>
                        <groupId>hsqldb</groupId>
                        <artifactId>hsqldb</artifactId>
                        <version>1.8.0.7</version>
                    </dependency>
                </dependencies>
            </plugin>
        </plugins>
    </build>

The parameters match up with those on the ant interface, see UsingTheAntInterface for more information. Currently (3.0M3), the maven parmaters differ from the ant interface in the following ways:google

這些參數匹配ant接口,更多的信息看使用ant接口。目前(3.0M3)版本maven參數不一樣與ant接口在下面幾個方面:

  • the ant dir parameter is called scriptdirectory in the maven plugin

  • ant dir參數在maven插件中被稱爲目錄腳本

The maven plugin supports the following goals:

maven插件支持下面的目標:

  • db-scripts: executes dbdeploy in "output file" mode

  • 數據庫腳本:執行dbdeploy「輸出文件」模式

  • update: executes dbdeploy in "direct to database" mode

  • 更新:執行dbdeploy在「直接數據庫」模式

So, you can use mvn dbdepoy:update in a directory with a configured pom to apply updates to the database. As with any plugin you canconfigure a dbdeploy goal to execute automatically in any maven lifecycle phase. None of its goals bind to a lifecycle phase by default.

因此,你可使用:

mvn dbdeploy:update 

去運行一個數據庫的更新這個更新是配置在pom文件裏的。正如任何插件,您能夠配置dbdeploy目標自動執行任何Maven生命週期階段。它的目標不綁定到一個默認的生命週期階段。

You can use:

 mvn help:describe -Dplugin=com.dbdeploy:maven-dbdeploy-plugin -Ddetail

 to get full plugin documentation.

你也可使用

mvn help:describe -Dplugin=com.dbdeploy:maven-dbdeploy-plugin -Ddetail

獲取所有的插件文檔

Special note for the 3.0M3 release

3.0M3版本須要特別注意的

Unfortunately the pom.xml in the examples directory of the distribution is incorrect, see issue 56 for details.

很不幸的是,pom.xml文件在分佈例子的目錄中是不正確的,詳細看問題56

Specifically, you need to replace the version of 3.0-SNAPSHOT with 3.0M3 for it to work. Apologies.

具體的,你須要使用3.03M替換3.0-SNAPSHOT版本讓他繼續工做,抱歉

相關文章
相關標籤/搜索