io.github.yangshuo:db-deployer-maven-plugin

simple database script management library

License

License

Categories

Categories

Maven Build Tools
GroupId

GroupId

io.github.yangshuo
ArtifactId

ArtifactId

db-deployer-maven-plugin
Last Version

Last Version

1.0.2
Release Date

Release Date

Type

Type

maven-plugin
Description

Description

simple database script management library

Download db-deployer-maven-plugin

How to add to project

<plugin>
    <groupId>io.github.yangshuo</groupId>
    <artifactId>db-deployer-maven-plugin</artifactId>
    <version>1.0.2</version>
</plugin>

Dependencies

compile (2)

Group / Artifact Type Version
io.github.yangshuo : db-deployer-impl jar 1.0.2
org.apache.maven : maven-plugin-api jar 3.0

provided (1)

Group / Artifact Type Version
org.apache.maven.plugin-tools : maven-plugin-annotations jar 3.4

Project Modules

There are no modules declared in this project.

[TOC]

Recommended Project Structure

project
|  pom.xml
|__sqls
   |  DDL_20180801231423.sql
   |  DML_20180801531423.sql
   |  ...

Usage

Use the plugin

<build>
		<plugins>
			<plugin>
				<groupId>io.github.yangshuo</groupId>
				<artifactId>db-deployer-maven-plugin</artifactId>
				<version>1.0.2-SNAPSHOT</version>
			</plugin>
		</plugins>
	</build>

Configuration

Config the plugin in xml

	<build>
		<plugins>
			<plugin>
				<groupId>io.github.yangshuo</groupId>
				<artifactId>db-deployer-maven-plugin</artifactId>
				<version>1.0.2-SNAPSHOT</version>
				<configuration>
					<driverClass>com.mysql.jdbc.Driver</driverClass>
					<url>jdbc:mysql://localhost:3306/demo</url>
					<username>demo</username>
					<password>demo</password>
					<sqlScriptDir>sqls</sqlScriptDir>
					<sqlStatementDelimiter>/</sqlStatementDelimiter>
				</configuration>
			</plugin>
		</plugins>
	</build>
  • jdbcDriver : The name of the jdbc driver used, for example com.mysql.jdbc.Driver
  • url : The jdbc url, for example jdbc:mysql://localhost:3306/demo
  • username : The user name used to connect to db
  • password : The password used to connect to db
  • sqlScriptDir : The diectory of the sql scripts
  • sqlStatementDelimiter: The statement delimiter used to split sql statement in sql files, for example semicolon(;)

Config the plugin using system properties

	<build>
		<plugins>
			<plugin>
				<groupId>org.yshio.github.yangshuo</groupId>
				<artifactId>db-deployer-maven-plugin</artifactId>
				<version>1.0.2-SNAPSHOT</version>
			</plugin>
		</plugins>
	</build>
	mvn dbdeployer:reset
		-Djdbc.driverClass=com.mysql.jdbc.Driver 
		-Djdbc.url=jdbc:mysql://localhost:3306/demo 
		-Djdbc.username=demo 
		-Djdbc.password=demo 
		-Dsql.scriptDir=sqls 
		-Dsql.statementDelimiter=;

Goals

  • dbdeployer:DDL
    Create a new DDL script file
  • dbdeployer:DML
    Create a new DML script file
  • dbdeployer:reset
    Execute all the sql script files
  • dbdeployer:update
    Execute the un executed sql script file

Versions

Version
1.0.2