Class LiquiBaseSqlMojo

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

@Mojo(name="liquibase-sql", requiresDependencyResolution=COMPILE_PLUS_RUNTIME) @Execute(goal="liquibase-sql", phase=PROCESS_RESOURCES) public class LiquiBaseSqlMojo extends AbstractLuteceWebappMojo
Tags SQL resources with liquibase tags. The default behaviour is to overwrite SQL files.
  • Field Details

  • Constructor Details

    • LiquiBaseSqlMojo

      public LiquiBaseSqlMojo()
  • Method Details

    • 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
    • isTaggedWithLiquibase

      public static boolean isTaggedWithLiquibase(String content)
      Returns true if the content is already tagged with a liquibase tag
      Parameters:
      content -
      Returns:
      the current "tagged" status
    • isTaggedWithLiquibase

      public static boolean isTaggedWithLiquibase(File candidate, List<String> listFileErrors, String strBasePath)
    • containsSqlOrders

      public static boolean containsSqlOrders(String content)
      Checks if the given text contains SQL orders like SELECT, INSERT, UPDATE, DELETE, CREATE, ALTER, DROP, TRUNCATE, GRANT, REVOKE. The check is case-insensitive and looks for whole words only.
      Parameters:
      content - The text to check
      Returns:
      true if any SQL order is found; false otherwise
    • isFileManagedByLiquibase

      public static boolean isFileManagedByLiquibase(File candidate, String strBasePath)
      Tells whether plugin-liquibase runs an SQL file, which must then be copied to WEB-INF/classes/sql: a script SqlPathInfo recognizes, or a pre-execution script (RunAfterOrdering.isPrerunScript(String)) wherever it sits.
      Parameters:
      candidate - the SQL file
      strBasePath - the absolute path of the WEB-INF/sql directory
      Returns:
      true if plugin-liquibase runs the file