flyway-validator-maven-plugin

Maven plugin to fail a build when duplicate flyway revises are found.

Лицензия

Лицензия

MIT
Категории

Категории

Maven Компиляция и сборка Flyway Данные Базы данных
Группа

Группа

io.github.jebeaudet
Идентификатор

Идентификатор

flyway-validator-maven-plugin
Последняя версия

Последняя версия

0.4.1
Дата

Дата

Тип

Тип

maven-plugin
Описание

Описание

flyway-validator-maven-plugin
Maven plugin to fail a build when duplicate flyway revises are found.
Ссылка на сайт

Ссылка на сайт

https://github.com/jebeaudet/flyway-validator-maven-plugin
Система контроля версий

Система контроля версий

https://github.com/jebeaudet/flyway-validator-maven-plugin

Скачать flyway-validator-maven-plugin

Как подключить последнюю версию

<plugin>
    <groupId>io.github.jebeaudet</groupId>
    <artifactId>flyway-validator-maven-plugin</artifactId>
    <version>0.4.1</version>
</plugin>

Зависимости

compile (4)

Идентификатор библиотеки Тип Версия
org.apache.maven : maven-plugin-api jar 3.3.9
org.apache.maven : maven-core jar 3.3.9
org.apache.maven.plugin-tools : maven-plugin-annotations jar 3.4
com.google.guava : guava jar 24.1.1-jre

test (1)

Идентификатор библиотеки Тип Версия
junit : junit jar 4.13.1

Модули Проекта

Данный проект не имеет модулей.

MIT license Maven Central

Flyway validator maven plugin

This plugin will help you avoid duplicate revises when working with Flyway. Duplicate revises sometimes happen when concurrent PR are being merged or lunatic developers forget to validate their old PR against the current codebase.

By using this plugin, the build will fail when problematic version numbers are found in the project.

How to use

The plugin is available on Maven central, just add this to your project or parent pom.xml :

<build>
  </plugins>
    <plugin>
      <groupId>io.github.jebeaudet</groupId>
      <artifactId>flyway-validator-maven-plugin</artifactId>
      <version>0.4.1</version>
      <executions>
        <execution>
          <goals>
            <goal>validate-flyway-revises</goal>
          </goals>
        </execution>
      </executions>
    </plugin>
  </plugins>
</build>

This will make the plugin run in the default verify phase of Maven. While you're free to change the default phase, be aware that to support java revises, this plugin needs to run after the compile phase.

Configuration

The following properties can be configured :

  • Root path of source files;
  • Path for SQL migrations;
  • Base package for .java migrations;
  • Flag to fail the build if invalid SQL filenames are found;
  • Ignore regex when scanning for filenames, useful to filter out automatic save file generated by editors.

This is done in the plugin configuration (default values shown here) :

<plugin>
    <groupId>io.github.jebeaudet</groupId>
    <artifactId>flyway-validator-maven-plugin</artifactId>
    <version>0.4.1</version>
    <configuration>
        <rootPath>/src/main/resources</rootPath>
        <sqlRevisesRootPath>db/migration</sqlRevisesRootPath>
        <javaRevisesPackage>db.migration</javaRevisesPackage>
        <abortBuildOnInvalidFilenames>true</abortBuildOnInvalidFilenames>
        <ignoredFileRegex>.*~$</ignoredFileRegex>
    </configuration>
</plugin>

Example

Here's an example of a failed build :

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal io.github.jebeaudet:flyway-validator-maven-plugin:0.3.4:validate-flyway-revises (default) on project test-project:
[ERROR] ------------------------------------------------------------------------
[ERROR] Duplicate migration version(s) found : [1.0, 1.0.1].
[ERROR] Details :
[ERROR] FlywayMigration [version=1.0, filename=V1.0__InitialSetup.sql]
[ERROR] FlywayMigration [version=1.0, filename=V1.0__Conflict.sql]
[ERROR] FlywayMigration [version=1.0.1, filename=V1.0.1__AddConstraint.sql]
[ERROR] FlywayMigration [version=1.0.1, filename=V1_0_1__AddAnotherConstraint.java]
[ERROR] ------------------------------------------------------------------------

Question or found a bug?

Open an issue! PR are also welcome.

Версии библиотеки

Версия
0.4.1
0.4
0.3.4
0.3.3
0.3.2
0.3.1
0.3