Fork me on GitHub

jpa-schema:generate

Full name:

io.github.divinespear:jpa-schema-maven-plugin:0.2.1:generate

Description:

Generate database schema or DDL scripts.

Attributes:

  • Requires a Maven project to be executed.
  • Binds by default to the lifecycle phase: process-classes.

Required Parameters

Name Type Since Description
databaseAction String - schema generation action for database

support value is none, create, drop, drop-and-create, or create-or-extend-tables.

create-or-extend-tables only support for EclipseLink with database target.


Default value is: none.
format boolean - generate as formatted
Default value is: false.
User property is: jpa-schema.generate.format.
persistenceUnitName String - unit name of persistence.xml
Default value is: default.
persistenceXml String - location of persistence.xml file

Note for Hibernate DOES NOT SUPPORT custom location. (SchemaExport support it, but JPA 2.1 schema generator does NOT.)


Default value is: META-INF/persistence.xml.
scanTestClasses boolean - scan test classes
Default value is: false.
User property is: jpa-schema.generate.scan-test-classes.
scriptAction String - schema generation action for script

support value is none, create, drop, or drop-and-create.


Default value is: none.
skip boolean - skip schema generation
Default value is: false.
User property is: jpa-schema.generate.skip.

Optional Parameters

Name Type Since Description
createOutputFileName String - generated create script name

REQUIRED for scriptAction is one of create, or drop-and-create.


Default value is: create.sql.
createSourceFile File - create source file path.

REQUIRED for createSourceMode is one of script, metadata-then-script, or script-then-metadata.


createSourceMode String - specifies whether the creation of database artifacts is to occur on the basis of the object/relational mapping metadata, DDL script, or a combination of the two.

support value is metadata, script, metadata-then-script, or script-then-metadata.


Default value is: metadata.
databaseMajorVersion Integer - database major version for emulate database connection. this should useful for script-only action.
  • specified if sufficient database version information is not included from DatabaseMetaData.getDatabaseProductName()
  • The value of this property should be the value returned for the target database by DatabaseMetaData.getDatabaseMajorVersion()

databaseMinorVersion Integer - database minor version for emulate database connection. this should useful for script-only action.
  • specified if sufficient database version information is not included from DatabaseMetaData.getDatabaseProductName()
  • The value of this property should be the value returned for the target database by DatabaseMetaData.getDatabaseMinorVersion()

databaseProductName String - database product name for emulate database connection. this should useful for script-only action.
  • specified if scripts are to be generated by the persistence provider and a connection to the target database is not supplied.
  • The value of this property should be the value returned for the target database by DatabaseMetaData.getDatabaseProductName()

dropOutputFileName String - generated drop script name

REQUIRED for scriptAction is one of drop, or drop-and-create.


Default value is: drop.sql.
dropSourceFile File - drop source file path.

REQUIRED for dropSourceMode is one of script, metadata-then-script, or script-then-metadata.


dropSourceMode String - specifies whether the dropping of database artifacts is to occur on the basis of the object/relational mapping metadata, DDL script, or a combination of the two.

support value is metadata, script, metadata-then-script, or script-then-metadata.


Default value is: metadata.
jdbcDriver String - jdbc driver class name

default is declared class name in persistence xml.

and Remember, No Russian you MUST configure jdbc driver as plugin's dependency.


jdbcPassword String - jdbc connection password

default is declared password in persistence xml.

If your account has no password (especially local file-base, like Apache Derby, H2, etc...), it can be omitted.


jdbcUrl String - jdbc connection url

default is declared connection url in persistence xml.


jdbcUser String - jdbc connection username

default is declared username in persistence xml.


lineSeparator String - line separator for generated schema file.

support value is one of CRLF (windows default), LF (*nix, max osx), and CR (classic mac), in case-insensitive.

default value is system property line.separator. if JVM cannot detect line.separator, then use LF by git core.autocrlf handling.


outputDirectory File - output directory for generated ddl scripts

REQUIRED for scriptAction is one of create, drop, or drop-and-create.


Default value is: ${project.build.directory}/generated-schema.
packageToScan List - list of package name for scan entity classes

REQUIRED for project without persistence.xml


properties Map - JPA vendor specific properties.
vendor JpaSchemaGeneratorMojo$Vendor - JPA vendor name or class name of vendor's PersistenceProvider implemention.

vendor name is one of

  • eclipselink
  • hibernate

REQUIRED for project without persistence.xml


Parameter Details

createOutputFileName:

generated create script name

REQUIRED for scriptAction is one of create, or drop-and-create.

  • Type: java.lang.String
  • Required: No
  • Default: create.sql

createSourceFile:

create source file path.

REQUIRED for createSourceMode is one of script, metadata-then-script, or script-then-metadata.

  • Type: java.io.File
  • Required: No

createSourceMode:

specifies whether the creation of database artifacts is to occur on the basis of the object/relational mapping metadata, DDL script, or a combination of the two.

support value is metadata, script, metadata-then-script, or script-then-metadata.

  • Type: java.lang.String
  • Required: No
  • Default: metadata

databaseAction:

schema generation action for database

support value is none, create, drop, drop-and-create, or create-or-extend-tables.

create-or-extend-tables only support for EclipseLink with database target.

  • Type: java.lang.String
  • Required: Yes
  • Default: none

databaseMajorVersion:

database major version for emulate database connection. this should useful for script-only action.
  • specified if sufficient database version information is not included from DatabaseMetaData.getDatabaseProductName()
  • The value of this property should be the value returned for the target database by DatabaseMetaData.getDatabaseMajorVersion()
  • Type: java.lang.Integer
  • Required: No

databaseMinorVersion:

database minor version for emulate database connection. this should useful for script-only action.
  • specified if sufficient database version information is not included from DatabaseMetaData.getDatabaseProductName()
  • The value of this property should be the value returned for the target database by DatabaseMetaData.getDatabaseMinorVersion()
  • Type: java.lang.Integer
  • Required: No

databaseProductName:

database product name for emulate database connection. this should useful for script-only action.
  • specified if scripts are to be generated by the persistence provider and a connection to the target database is not supplied.
  • The value of this property should be the value returned for the target database by DatabaseMetaData.getDatabaseProductName()
  • Type: java.lang.String
  • Required: No

dropOutputFileName:

generated drop script name

REQUIRED for scriptAction is one of drop, or drop-and-create.

  • Type: java.lang.String
  • Required: No
  • Default: drop.sql

dropSourceFile:

drop source file path.

REQUIRED for dropSourceMode is one of script, metadata-then-script, or script-then-metadata.

  • Type: java.io.File
  • Required: No

dropSourceMode:

specifies whether the dropping of database artifacts is to occur on the basis of the object/relational mapping metadata, DDL script, or a combination of the two.

support value is metadata, script, metadata-then-script, or script-then-metadata.

  • Type: java.lang.String
  • Required: No
  • Default: metadata

format:

generate as formatted
  • Type: boolean
  • Required: Yes
  • User Property: jpa-schema.generate.format
  • Default: false

jdbcDriver:

jdbc driver class name

default is declared class name in persistence xml.

and Remember, No Russian you MUST configure jdbc driver as plugin's dependency.

  • Type: java.lang.String
  • Required: No

jdbcPassword:

jdbc connection password

default is declared password in persistence xml.

If your account has no password (especially local file-base, like Apache Derby, H2, etc...), it can be omitted.

  • Type: java.lang.String
  • Required: No

jdbcUrl:

jdbc connection url

default is declared connection url in persistence xml.

  • Type: java.lang.String
  • Required: No

jdbcUser:

jdbc connection username

default is declared username in persistence xml.

  • Type: java.lang.String
  • Required: No

lineSeparator:

line separator for generated schema file.

support value is one of CRLF (windows default), LF (*nix, max osx), and CR (classic mac), in case-insensitive.

default value is system property line.separator. if JVM cannot detect line.separator, then use LF by git core.autocrlf handling.

  • Type: java.lang.String
  • Required: No

outputDirectory:

output directory for generated ddl scripts

REQUIRED for scriptAction is one of create, drop, or drop-and-create.

  • Type: java.io.File
  • Required: No
  • Default: ${project.build.directory}/generated-schema

packageToScan:

list of package name for scan entity classes

REQUIRED for project without persistence.xml

  • Type: java.util.List
  • Required: No

persistenceUnitName:

unit name of persistence.xml
  • Type: java.lang.String
  • Required: Yes
  • Default: default

persistenceXml:

location of persistence.xml file

Note for Hibernate DOES NOT SUPPORT custom location. (SchemaExport support it, but JPA 2.1 schema generator does NOT.)

  • Type: java.lang.String
  • Required: Yes
  • Default: META-INF/persistence.xml

properties:

JPA vendor specific properties.
  • Type: java.util.Map
  • Required: No

scanTestClasses:

scan test classes
  • Type: boolean
  • Required: Yes
  • User Property: jpa-schema.generate.scan-test-classes
  • Default: false

scriptAction:

schema generation action for script

support value is none, create, drop, or drop-and-create.

  • Type: java.lang.String
  • Required: Yes
  • Default: none

skip:

skip schema generation
  • Type: boolean
  • Required: Yes
  • User Property: jpa-schema.generate.skip
  • Default: false

vendor:

JPA vendor name or class name of vendor's PersistenceProvider implemention.

vendor name is one of

  • eclipselink
  • hibernate

REQUIRED for project without persistence.xml

  • Type: io.github.divinespear.maven.plugin.JpaSchemaGeneratorMojo$Vendor
  • Required: No