[英]Maven Flyway Executing Plugin
我有一個flyway項目,在對flyway:migrate
任何調用時,我都想運行groovy插件來執行一些groovy腳本。 這是我的pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<dependencies>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
<version>2.4.15</version>
</dependency>
<dependency>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-core</artifactId>
<version>5.0.6</version>
</dependency>
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<version>6.1.0.jre8</version>
</dependency>
</dependencies>
<profiles>
<profile>
<id>LOCAL</id>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.gmaven</groupId>
<artifactId>groovy-maven-plugin</artifactId>
<version>2.0</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>execute</goal>
</goals>
<configuration>
<source>${pom.basedir}/fooScript.groovy</source>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-maven-plugin</artifactId>
<version>5.0.6</version>
<configuration>
<url>${url}</url>
<user>${user}</user>
<password>${pass}</password>
<locations>${locations}</locations>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
但是groovy插件僅在您執行flyway:migrate
with LOCAL profile set時才執行。
我如何設置它,以便每次調用flyway:migrate
都運行插件,而不考慮配置文件。
完全改變方法怎么樣? 如果您切換到基於Java的Flyway回調,而實際上又要調用所需的Groovy腳本,那么您要嘗試實現的功能實際上是微不足道的。 參見https://flywaydb.org/documentation/callbacks
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.