Class ImportDataMojo

java.lang.Object
org.apache.maven.plugin.AbstractMojo
org.fastnate.maven.ImportDataMojo
All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo

@Mojo(name="import-data", threadSafe=true, defaultPhase=PROCESS_CLASSES, requiresDependencyResolution=COMPILE) public class ImportDataMojo extends org.apache.maven.plugin.AbstractMojo
Creates an SQL file from all DataProvider.
Author:
Tobias Liefke
  • Field Details

    • SETTINGS_KEY

      private static final String SETTINGS_KEY
    • context

      @Inject private org.sonatype.plexus.build.incremental.BuildContext context
      The current build context for incremental builds.
    • project

      @Inject private org.apache.maven.project.MavenProject project
      The POM project.
    • skip

      @Parameter private boolean skip
      Indicates to skip the execution of this plugin, even if it is configured for a phase.
    • dialect

      @Parameter private String dialect
      The name of the database dialect.
    • packages

      @Parameter private String packages
      The packages to scan for data providers.
    • dataFolder

      @Parameter(defaultValue="${basedir}/src/main/data") private File dataFolder
      The data folder for importers (e.g. to import CSV files).
    • sqlFile

      @Parameter(defaultValue="${project.build.outputDirectory}/data.sql") private File sqlFile
      The path to the output file.
    • encoding

      @Parameter(defaultValue="UTF-8") private String encoding
      The encoding of the target and the prefix / postfix files.
    • prefix

      @Parameter private String prefix
      One or more SQL files in the data folder, or an SQL snippet itself - to put that before the generated SQL.
    • postfix

      @Parameter private String postfix
      One or more SQL files in the data folder, or an SQL snippet itself - to put that after the generated SQL.
    • relevantFiles

      @Parameter private String[] relevantFiles
      A list of patterns for files which are monitored and start the generation when changed. See changeDetector for more complicated change detection. All patterns are relative to the "src" directory, as Eclipse Bug 508238 prevents patterns relative to the base directory.
    • changeDetector

      @Parameter private String changeDetector
      The implementation class of DataChangeDetector, to check if a changed file is relevant for SQL generation.
    • additionalSettings

      @Parameter private Map<String,String> additionalSettings
      Any additional settings for the EntitySqlGenerator, see GeneratorContext for an overview of available settings. Add a setting with: <setting_name>setting_value</setting_name>
  • Constructor Details

    • ImportDataMojo

      public ImportDataMojo()
  • Method Details

    • addProperty

      private static void addProperty(Properties settings, String key, String value)
    • isAnnotationPresent

      private static boolean isAnnotationPresent(Class<?> c, Class<? extends Annotation>... annotations)
    • removeObsoleteFiles

      private static void removeObsoleteFiles(Properties oldSettings, Properties newSettings)
    • buildClassLoader

      private URLClassLoader buildClassLoader() throws org.apache.maven.plugin.MojoExecutionException
      Throws:
      org.apache.maven.plugin.MojoExecutionException
    • detectChanges

      private boolean detectChanges(Properties newSettings, File outputFile)
    • detectFilePropertyChanges

      private boolean detectFilePropertyChanges(Properties properties, String key, File outputFile)
    • detectRelevantChagesUsingDetector

      private boolean detectRelevantChagesUsingDetector()
    • detectRelevantClassFileChanges

      private boolean detectRelevantClassFileChanges()
    • detectRelevantFileChanges

      private boolean detectRelevantFileChanges()
    • detectRelevantSourceFileChanges

      private boolean detectRelevantSourceFileChanges()
    • execute

      public void execute() throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException
      Throws:
      org.apache.maven.plugin.MojoExecutionException
      org.apache.maven.plugin.MojoFailureException