飞行路线“迁移” ant 任务错误:“无法找到 sql 迁移的路径 [...]”

发布于 2025-01-04 15:44:47 字数 2159 浏览 1 评论 0原文

我无法指定包含 .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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

哆兒滾 2025-01-11 15:44:48

尝试将 flyway.classpath属性更改为路径

对于您的情况,这意味着将以下内容更改为

<property name="flyway.classpath" value="c:\DeployTest"/>

<path id="flyway.classpath">
    <fileset dir="c:\DeployTest"/>
</path>

Try changing flyway.classpath from a property to a path.

For your case this means changing this:

<property name="flyway.classpath" value="c:\DeployTest"/>

to this:

<path id="flyway.classpath">
    <fileset dir="c:\DeployTest"/>
</path>
ぽ尐不点ル 2025-01-11 15:44:48

而不是这个:

<path id="flyway.classpath"> 
    <fileset dir="c:\DeployTest"/> 
</path>

使用:

<path id="flyway.classpath">  
      <pathelement location="c:\DeployTest"/>
</path>  

Instead of this:

<path id="flyway.classpath"> 
    <fileset dir="c:\DeployTest"/> 
</path>

Use:

<path id="flyway.classpath">  
      <pathelement location="c:\DeployTest"/>
</path>  
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文