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

simple database script management library

License

License

Categories

Categories

Maven Build Tools
GroupId

GroupId

io.github.yangshuo
ArtifactId

ArtifactId

db-deployer-maven-plugin-demo
Last Version

Last Version

1.0.2
Release Date

Release Date

Type

Type

pom
Description

Description

simple database script management library

Download db-deployer-maven-plugin-demo

How to add to project

<!-- https://jarcasting.com/artifacts/io.github.yangshuo/db-deployer-maven-plugin-demo/ -->
<dependency>
    <groupId>io.github.yangshuo</groupId>
    <artifactId>db-deployer-maven-plugin-demo</artifactId>
    <version>1.0.2</version>
    <type>pom</type>
</dependency>
// https://jarcasting.com/artifacts/io.github.yangshuo/db-deployer-maven-plugin-demo/
implementation 'io.github.yangshuo:db-deployer-maven-plugin-demo:1.0.2'
// https://jarcasting.com/artifacts/io.github.yangshuo/db-deployer-maven-plugin-demo/
implementation ("io.github.yangshuo:db-deployer-maven-plugin-demo:1.0.2")
'io.github.yangshuo:db-deployer-maven-plugin-demo:pom:1.0.2'
<dependency org="io.github.yangshuo" name="db-deployer-maven-plugin-demo" rev="1.0.2">
  <artifact name="db-deployer-maven-plugin-demo" type="pom" />
</dependency>
@Grapes(
@Grab(group='io.github.yangshuo', module='db-deployer-maven-plugin-demo', version='1.0.2')
)
libraryDependencies += "io.github.yangshuo" % "db-deployer-maven-plugin-demo" % "1.0.2"
[io.github.yangshuo/db-deployer-maven-plugin-demo "1.0.2"]

Dependencies

compile (1)

Group / Artifact Type Version
mysql : mysql-connector-java jar 6.0.6

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