如何更改以下flyway-maven-plugin
配置,以便我可以在src/main/database
而不是src/main/resources/db/migration
中删除我的脚本?
migrate
mojo source code似乎表示默认值为db/migration
,但是src/main/resources/
呢?
<plugin>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-maven-plugin</artifactId>
<version>3.2.1</version>
<configuration>
<url>jdbc:h2:file:target/tmp</url>
<user>sa</user>
</configuration>
<dependencies>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>1.4.190</version>
</dependency>
</dependencies>
</plugin>
答案 0 :(得分:5)
将locations
属性设置为所需的目录。前缀为filesystem:
,如果它位于文件系统而不是类路径上:http://flywaydb.org/documentation/maven/migrate.html
对于您的用例,请使用以下内容:
<plugin>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-maven-plugin</artifactId>
<version>3.2.1</version>
<configuration>
<url>jdbc:h2:file:target/tmp</url>
<user>sa</user>
<locations>
<location>filesystem:src/main/database</location>
</locations>
</configuration>
<dependencies>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>1.4.190</version>
</dependency>
</dependencies>
</plugin>