Package org.apache.openjpa.tools.maven
Class AbstractOpenJpaMojo
java.lang.Object
org.apache.maven.plugin.AbstractMojo
org.apache.openjpa.tools.maven.AbstractOpenJpaMojo
- All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled
,org.apache.maven.plugin.Mojo
- Direct Known Subclasses:
AbstractOpenJpaEnhancerMojo
,AbstractOpenJpaMappingToolMojo
public abstract class AbstractOpenJpaMojo
extends org.apache.maven.plugin.AbstractMojo
Base class for OpenJPA maven tasks.
- Version:
- $Id$
-
Field Summary
Modifier and TypeFieldDescriptionprotected File
Location wherepersistence-enabled
classes are located.List of all class path elements that will be searched for thepersistence-enabled
classes and resources expected by PCEnhancer.protected static final String
the string used for passing information about the connectionDriverNameprotected static final String
the string used for passing information about the connectionPropertiesprotected static final String
The properties option is used for passing information about the persistence.xml classpath resource and the default unitprotected static final String
the properties option is used for passing information about the persistence.xml file locationprotected org.apache.maven.project.MavenProject
The Maven Project Objectprotected File
The working directory for putting persistence.xml and other stuff into if we need to.Fields inherited from interface org.apache.maven.plugin.Mojo
ROLE
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected Options
This function will usually get called bygetOptions()
protected void
This will prepare the current ClassLoader and add all jars and local classpaths (e.g. target/classes) needed by the OpenJPA task.Locates and returns a list of class files found under specified class directory.This function retrieves the injected classpath elements for the current mojo.protected File
The File where the class files of the entities to enhance resideprotected String[]
getFilePaths
(List<File> files) protected abstract Options
Get the options for the various OpenJPA tools.protected boolean
skipMojo()
Determine if the mojo execution should get skipped.Methods inherited from class org.apache.maven.plugin.AbstractMojo
getLog, getPluginContext, setLog, setPluginContext
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.apache.maven.plugin.Mojo
execute
-
Field Details
-
workDir
@Parameter(property="openjpa.workdir", defaultValue="${project.build.directory}/openjpa-work", required=true) protected File workDirThe working directory for putting persistence.xml and other stuff into if we need to. -
classes
@Parameter(property="openjpa.classes", defaultValue="${project.build.outputDirectory}", required=true) protected File classesLocation wherepersistence-enabled
classes are located. -
OPTION_CONNECTION_DRIVER_NAME
the string used for passing information about the connectionDriverName- See Also:
-
OPTION_CONNECTION_PROPERTIES
the string used for passing information about the connectionProperties- See Also:
-
compileClasspathElements
@Parameter(defaultValue="${project.compileClasspathElements}", required=true, readonly=true) protected List<String> compileClasspathElementsList of all class path elements that will be searched for thepersistence-enabled
classes and resources expected by PCEnhancer. -
project
@Parameter(defaultValue="${project}", required=true, readonly=true) protected org.apache.maven.project.MavenProject projectThe Maven Project Object -
OPTION_PROPERTIES_FILE
the properties option is used for passing information about the persistence.xml file location- See Also:
-
OPTION_PROPERTIES
The properties option is used for passing information about the persistence.xml classpath resource and the default unit- See Also:
-
-
Constructor Details
-
AbstractOpenJpaMojo
public AbstractOpenJpaMojo()default ct
-
-
Method Details
-
getEntityClasses
The File where the class files of the entities to enhance reside- Returns:
- normaly the entity classes are located in target/classes
-
getClasspathElements
This function retrieves the injected classpath elements for the current mojo.- Returns:
- List of classpath elements for the compile phase
-
getOptions
Get the options for the various OpenJPA tools.- Returns:
- populated Options
- Throws:
org.apache.maven.plugin.MojoExecutionException
-
skipMojo
protected boolean skipMojo()Determine if the mojo execution should get skipped.
This is the case if:skip
istrue
- if the mojo gets executed on a project with packaging type 'pom' and
forceMojoExecution
isfalse
- Returns:
true
if the mojo execution should be skipped.
-
createOptions
This function will usually get called bygetOptions()
- Returns:
- the Options filled with the initial values
- Throws:
org.apache.maven.plugin.MojoExecutionException
-
extendRealmClasspath
protected void extendRealmClasspath() throws org.apache.maven.plugin.MojoExecutionExceptionThis will prepare the current ClassLoader and add all jars and local classpaths (e.g. target/classes) needed by the OpenJPA task.- Throws:
org.apache.maven.plugin.MojoExecutionException
- on any error inside the mojo
-
findEntityClassFiles
Locates and returns a list of class files found under specified class directory.- Returns:
- list of class files.
- Throws:
org.apache.maven.plugin.MojoExecutionException
- if there was an error scanning class file resources.
-
getFilePaths
- Parameters:
files
- List of files- Returns:
- the paths of the given files as String[]
-