飞行路线“迁移” ant 任务错误:“无法找到 sql 迁移的路径 [...]”
我无法指定包含 .sql 文件的目录的正确路径。我尝试将“baseDir”属性设置为不同位置(当然在类路径中)的不同目录,并设置不同的类路径。构建脚本总是会出现消息“无法找到 sql 迁移的路径:[uri 到带有 . sql 文件]”。
它看起来不像 问题 156,如 类似的问题,当然如果我删除 SqlMigrationResolver.java 中的代码
if (StringUtils.hasText(baseDir) && !new ClassPathResource(baseDir + "/",
classLoader).exists()) {
LOG.warn("Unable to find path for sql migrations: " + baseDir);
return migrations;
}
,如 Comment #9 中所述 我仍然发现
deployDB:
[flyway:migrate] com.googlecode.flyway.core.exception.FlywayException: Error loading sql migration files
[flyway:migrate] Caused by java.io.FileNotFoundException: class path resource [db/migration/] cannot be resolved to URL because it does not exist
BUILD FAILED
c:\DeployTest\build.xml:208: Flyway Error: com.googlecode.flyway.core.exception.FlywayException: Error loading sql migration files
Flyway 落在
resources = new PathMatchingResourcePatternResolver(classLoader)
.getResources("classpath:" + searchRoot + searchPattern);
它无法执行 getResources 方法。
它看起来不像 bug,看起来我无法使用 SQL 脚本将正确的 uri 设置为目录 =(
请帮我设置这个该死的 uri!
我的 build.xml:
<target name="init-flyway">
<taskdef uri="antlib:com.googlecode.flyway.ant"
resource="com/googlecode/flyway/ant/antlib.xml"
/>
<property name="flyway.driver" value="${dbDriver}"/>
<property name="flyway.url" value="${dbUrl}"/>
<property name="flyway.user" value="${dbScheme}"/>
<property name="flyway.password" value="${dbPass}"/>
<property name="flyway.baseDir" value="\db\migration"/>
<property name="flyway.classpath" value="c:\DeployTest"/>
</target>
<target name="deployDB" depends="init-flyway">
<flyway:migrate/>
</target>
I can not specify the correct path to the directory with .sql files. I tried to set the "baseDir" attribute to different directories in different places (in classpath, of course) and set different classpath. Build scripts always falls with message “Unable to find path for sql migrations: [uri to directory with . sql files]”.
It's not looking like issue 156 as was said in similar question, becourse if I delete the code in SqlMigrationResolver.java
if (StringUtils.hasText(baseDir) && !new ClassPathResource(baseDir + "/",
classLoader).exists()) {
LOG.warn("Unable to find path for sql migrations: " + baseDir);
return migrations;
}
as was said in Comment #9 I still catch
deployDB:
[flyway:migrate] com.googlecode.flyway.core.exception.FlywayException: Error loading sql migration files
[flyway:migrate] Caused by java.io.FileNotFoundException: class path resource [db/migration/] cannot be resolved to URL because it does not exist
BUILD FAILED
c:\DeployTest\build.xml:208: Flyway Error: com.googlecode.flyway.core.exception.FlywayException: Error loading sql migration files
Flyway falls at
resources = new PathMatchingResourcePatternResolver(classLoader)
.getResources("classpath:" + searchRoot + searchPattern);
It can not execute getResources method.
It's not looking like bug, it's looking like I can not set right uri to directory with my SQL scripts =(
Please, help me to set this damn uri!
My build.xml:
<target name="init-flyway">
<taskdef uri="antlib:com.googlecode.flyway.ant"
resource="com/googlecode/flyway/ant/antlib.xml"
/>
<property name="flyway.driver" value="${dbDriver}"/>
<property name="flyway.url" value="${dbUrl}"/>
<property name="flyway.user" value="${dbScheme}"/>
<property name="flyway.password" value="${dbPass}"/>
<property name="flyway.baseDir" value="\db\migration"/>
<property name="flyway.classpath" value="c:\DeployTest"/>
</target>
<target name="deployDB" depends="init-flyway">
<flyway:migrate/>
</target>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试将 flyway.classpath 从属性更改为路径。
对于您的情况,这意味着将以下内容更改为
:
Try changing flyway.classpath from a property to a path.
For your case this means changing this:
to this:
而不是这个:
使用:
Instead of this:
Use: