[英]Running Flyway migrations with Jenkins and Gradle - Unable to resolve location classpath:db/migration
[英]Flyway in a Netbeans module: unable to resolve location
我有一個具有飛行依賴的Maven Netbeans模塊:
<dependency>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-core</artifactId>
<version>4.0</version>
</dependency>
在src / main / resources / db / migration位置,我有一個名為V1__Base_Version.sql的sql文件。
我從這樣的模塊中調用:
// Create the Flyway instance
Flyway flyway = new Flyway();
// Point it to the database
flyway.setDataSource(getStorageDatabaseURL(),
getStorageDatabaseUsername(),
getStorageDatabasePassword());
flyway.setBaselineOnMigrate(true);
flyway.setCleanDisabled(true);
//option: flyway.setLocations("classpath:db/migration");
// Start the migration
flyway.migrate();
根據flyway文檔 ,這應該是默認路徑,但是它不起作用,這意味着未找到遷移文件。
有什么選擇/想法嗎?
如果有人仍在尋找解決方案,則可以通過以下技巧成功在Netbeans模塊內使用Flyway:
db/migration/
,請在父文件夾(即db/
)中添加一個空類,然后在NetBeans模塊中將該父包(即db
)標記為公共包。 之后,NetBeans ProxyClassLoader能夠成功回答Flyway發出的getResources("db/migration")
查詢(在NetBeans 11.1上進行了測試)。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.