impex:schemasql

Full name:

org.kuali.maven.plugins:maven-impex-plugin:1.0.25:schemasql

Description:

Generates platform specific SQL from database agnostic XML files.

There are two types of SQL files created by this goal:

Type 1: DDL statements for creating tables, primary keys, indexes, and unique constraints. Does not contain DDL for enforcing relationships between tables.
Type 2: DDL statements for creating and enforcing relationships between tables

This allows data to be imported into multiple tables concurrently. Running the first type of SQL file will create the empty tables without any foreign key constraints. Data can then be loaded concurrently into the tables (using optimized high speed tools if desired) without needing to worry about the order in which the tables are loaded. After data has been loaded, the second type of SQL file can be run to add the relationships between the tables. As long as the data set is consistent and correct, all the relationships will get created correctly.

The database platform to generate SQL for is determined by ${targetDatabase}. See also impex:datasql

Attributes:

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

Required Parameters

Name Type Since Description
forceMojoExecution boolean - Setting this parameter to true will force the execution of this mojo, even if it would get skipped usually.
Default value is: false.
schemaDir String - The path to the directory where the schema XML files are located
Default value is: ${basedir}/src/main/impex.
schemaIncludes String - The schema files from that directory which should be included (ant-style notation).
Default value is: ${project.artifactId}.xml.

Optional Parameters

Name Type Since Description
outputDir String - The directory in which the SQL will be generated.
Default value is: ${project.build.directory}/classes/sql.
reportFile String - The location where the report file will be generated.
Default value is: ../../../reports/report.${project.artifactId}.sql.generation.
contextPropertiesPath String - The location where the context property file for velocity will be generated.
Default value is: ${project.build.directory}/reports/context.sql.properties.
suffix String - The suffix of the generated sql files.
encoding String - The encoding to use when reading/writing files. If not specified this defaults to the platform specific encoding of whatever machine the build is running on.
Default value is: ${project.build.sourceEncoding}.
runOnlyOnSchemaChange boolean - Determines if this task should run only if the schema has changed
Default value is: true.
skip boolean - When true, skip the execution of this mojo
Default value is: false.
sqlDbMap String - The path to the properties file containing the mapping sql file -> target database.
Default value is: ${project.build.directory}/reports/sqldbmap.properties.
startMavenLogger boolean - When true, redirect logging from Log4j and Jakarta Commons Logging to the Maven logging system
Default value is: true.
targetDatabase String - The type of database we are targeting (eg oracle, mysql). This is optional if url is supplied as the database type will be automatically detected based on the url. If targetDatabase is explicitly supplied it will override the type selected by the automatic detection logic.
targetPackage String - The target package for the generated classes.
Default value is: impex.generated.
templatePath String - The base path where the templates are read from, if they are not read from the classpath.
Default value is: ${basedir}/src/main/impex/templates.
url String - Database URL.
useClasspath boolean - Whether the templates should be loaded from the classpath.
Default value is: true.
userContextProperties Map - A map where all user-defined context properties can be set. Overrides all other mojo configuration settings which are mapped to context properties.

Parameter Details

outputDir:

The directory in which the SQL will be generated.
  • Type: java.lang.String
  • Required: No
  • Expression: ${outputDir}
  • Default: ${project.build.directory}/classes/sql

reportFile:

The location where the report file will be generated.
  • Type: java.lang.String
  • Required: No
  • Expression: ${reportFile}
  • Default: ../../../reports/report.${project.artifactId}.sql.generation

contextPropertiesPath:

The location where the context property file for velocity will be generated.
  • Type: java.lang.String
  • Required: No
  • Expression: ${contextPropertiesPath}
  • Default: ${project.build.directory}/reports/context.sql.properties

suffix:

The suffix of the generated sql files.
  • Type: java.lang.String
  • Required: No
  • Expression: ${suffix}

encoding:

The encoding to use when reading/writing files. If not specified this defaults to the platform specific encoding of whatever machine the build is running on.
  • Type: java.lang.String
  • Required: No
  • Expression: ${encoding}
  • Default: ${project.build.sourceEncoding}

forceMojoExecution:

Setting this parameter to true will force the execution of this mojo, even if it would get skipped usually.
  • Type: boolean
  • Required: Yes
  • Expression: ${forceMojoExecution}
  • Default: false

runOnlyOnSchemaChange:

Determines if this task should run only if the schema has changed
  • Type: boolean
  • Required: No
  • Expression: ${runOnlyOnSchemaChange}
  • Default: true

schemaDir:

The path to the directory where the schema XML files are located
  • Type: java.lang.String
  • Required: Yes
  • Expression: ${schemaDir}
  • Default: ${basedir}/src/main/impex

schemaIncludes:

The schema files from that directory which should be included (ant-style notation).
  • Type: java.lang.String
  • Required: Yes
  • Expression: ${schemaIncludes}
  • Default: ${project.artifactId}.xml

skip:

When true, skip the execution of this mojo
  • Type: boolean
  • Required: No
  • Default: false

sqlDbMap:

The path to the properties file containing the mapping sql file -> target database.
  • Type: java.lang.String
  • Required: No
  • Expression: ${sqlDbMap}
  • Default: ${project.build.directory}/reports/sqldbmap.properties

startMavenLogger:

When true, redirect logging from Log4j and Jakarta Commons Logging to the Maven logging system
  • Type: boolean
  • Required: No
  • Expression: ${startMavenLogger}
  • Default: true

targetDatabase:

The type of database we are targeting (eg oracle, mysql). This is optional if url is supplied as the database type will be automatically detected based on the url. If targetDatabase is explicitly supplied it will override the type selected by the automatic detection logic.
  • Type: java.lang.String
  • Required: No
  • Expression: ${targetDatabase}

targetPackage:

The target package for the generated classes.
  • Type: java.lang.String
  • Required: No
  • Expression: ${targetPackage}
  • Default: impex.generated

templatePath:

The base path where the templates are read from, if they are not read from the classpath.
  • Type: java.lang.String
  • Required: No
  • Expression: ${templatePath}
  • Default: ${basedir}/src/main/impex/templates

url:

Database URL.
  • Type: java.lang.String
  • Required: No
  • Expression: ${url}

useClasspath:

Whether the templates should be loaded from the classpath.
  • Type: boolean
  • Required: No
  • Expression: ${useClasspath}
  • Default: true

userContextProperties:

A map where all user-defined context properties can be set. Overrides all other mojo configuration settings which are mapped to context properties.
  • Type: java.util.Map
  • Required: No