openjpa:test-enhance

Full name:

org.codehaus.mojo:openjpa-maven-plugin:1.2:test-enhance

Description:

Processes Application model classes and enhances them by running Open JPA Enhancer tool.

Attributes:

  • Requires a Maven 2.0 project to be executed.
  • Requires dependency resolution of artifacts in scope: test.
  • Since version: 1.1.
  • Binds by default to the lifecycle phase: process-test-classes.

Required Parameters

Name Type Since Description
classes File 1.1 Location where persistence-enabled classes are located.
Default value is: ${project.build.outputDirectory}.
forceMojoExecution boolean 1.1 Setting this parameter to true will force the execution of this mojo, even if it would get skipped usually.
Default value is: false.

Optional Parameters

Name Type Since Description
addDefaultConstructor boolean 1.1 The JPA spec requires that all persistent classes define a no-arg constructor. This flag tells the enhancer whether to add a protected no-arg constructor to any persistent classes that don't already have one.
Default value is: true.
connectionDriverName String 1.1

This setting can be used to override any openjpa.ConnectionDriverName set in the persistence.xml. It can also be used if the persistence.xml contains no connection information at all.

Sample:

<connectionDriverName>com.mchange.v2.c3p0.ComboPooledDataSource</connectionDriverName>
This is most times used in conjunction with connectionProperties.
connectionProperties String 1.1

Used to define the credentials or any other connection properties.

Sample:
<connectionProperties>
  driverClass=com.mysql.jdbc.Driver,
  jdbcUrl=jdbc:mysql://localhost/mydatabase,
  user=root,
  password=,
  minPoolSize=5,
  acquireRetryAttempts=3,
  maxPoolSize=20
</connectionProperties>
This is most times used in conjunction with connectionDriverName.
enforcePropertyRestrictions boolean 1.1 Whether to throw an exception when it appears that a property access entity is not obeying the restrictions placed on property access.
Default value is: false.
excludes String 1.1 Comma separated list of excludes to scan searchDir to pass to the jobs. This option may be used to stop OpenJPA tasks from scanning non-JPA classes (which usually leads to warnings such as "Type xxx has no metadata")
includes String 1.1 Comma separated list of includes to scan searchDir to pass to the jobs. This may be used to restrict the OpenJPA tasks to e.g. a single package which contains all the entities.
Default value is: **/*.class.
persistenceXmlFile String 1.1 Used if a non-default file location for the persistence.xml should be used If not specified, the default one in META-INF/persistence.xml will be used. Please note that this is not a resource location but a file path!
skip boolean 1.0 When true, skip the execution.
Default value is: false.
tmpClassLoader boolean 1.1 Tell the PCEnhancer to use a temporary classloader for enhancement. If you enable this feature, then no depending artifacts from the classpath will be used! Please note that you have to disable the tmpClassLoader for some cases in OpenJPA-1.2.1 due to an extended parsing strategy.
Default value is: false.
toolProperties Properties 1.1 Additional properties passed to the OpenJPA tools.

Parameter Details

addDefaultConstructor:

The JPA spec requires that all persistent classes define a no-arg constructor. This flag tells the enhancer whether to add a protected no-arg constructor to any persistent classes that don't already have one.
  • Type: boolean
  • Since: 1.1
  • Required: No
  • Default: true

classes:

Location where persistence-enabled classes are located.
  • Type: java.io.File
  • Since: 1.1
  • Required: Yes
  • Expression: ${openjpa.classes}
  • Default: ${project.build.outputDirectory}

connectionDriverName:

This setting can be used to override any openjpa.ConnectionDriverName set in the persistence.xml. It can also be used if the persistence.xml contains no connection information at all.

Sample:

<connectionDriverName>com.mchange.v2.c3p0.ComboPooledDataSource</connectionDriverName>
This is most times used in conjunction with connectionProperties.
  • Type: java.lang.String
  • Since: 1.1
  • Required: No

connectionProperties:

Used to define the credentials or any other connection properties.

Sample:
<connectionProperties>
  driverClass=com.mysql.jdbc.Driver,
  jdbcUrl=jdbc:mysql://localhost/mydatabase,
  user=root,
  password=,
  minPoolSize=5,
  acquireRetryAttempts=3,
  maxPoolSize=20
</connectionProperties>
This is most times used in conjunction with connectionDriverName.
  • Type: java.lang.String
  • Since: 1.1
  • Required: No

enforcePropertyRestrictions:

Whether to throw an exception when it appears that a property access entity is not obeying the restrictions placed on property access.
  • Type: boolean
  • Since: 1.1
  • Required: No
  • Default: false

excludes:

Comma separated list of excludes to scan searchDir to pass to the jobs. This option may be used to stop OpenJPA tasks from scanning non-JPA classes (which usually leads to warnings such as "Type xxx has no metadata")
  • Type: java.lang.String
  • Since: 1.1
  • Required: No

forceMojoExecution:

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

includes:

Comma separated list of includes to scan searchDir to pass to the jobs. This may be used to restrict the OpenJPA tasks to e.g. a single package which contains all the entities.
  • Type: java.lang.String
  • Since: 1.1
  • Required: No
  • Default: **/*.class

persistenceXmlFile:

Used if a non-default file location for the persistence.xml should be used If not specified, the default one in META-INF/persistence.xml will be used. Please note that this is not a resource location but a file path!
  • Type: java.lang.String
  • Since: 1.1
  • Required: No

skip:

When true, skip the execution.
  • Type: boolean
  • Since: 1.0
  • Required: No
  • Default: false

tmpClassLoader:

Tell the PCEnhancer to use a temporary classloader for enhancement. If you enable this feature, then no depending artifacts from the classpath will be used! Please note that you have to disable the tmpClassLoader for some cases in OpenJPA-1.2.1 due to an extended parsing strategy.
  • Type: boolean
  • Since: 1.1
  • Required: No
  • Default: false

toolProperties:

Additional properties passed to the OpenJPA tools.
  • Type: java.util.Properties
  • Since: 1.1
  • Required: No