Flyway没有在db/migration中找到我的sql迁移

Jef*_*f D 8 flyway

错误:[错误] com.googlecode.flyway.core.api.FlywayException:无法确定类路径位置的URL:db/migration(ClassLoader:ClassRealm [plugin> com.googlecode.flyway:flyway-maven-plugin:2.1. 1,父母:sun.misc.Launcher$AppClassLoader@43be2d65])

我跟着快速启动,所以我还没有做任何复杂的事情.

的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>

  <groupId>com.cpt.migrations</groupId>
  <artifactId>cpt_migrations</artifactId>
  <version>1.0-SNAPSHOT</version>
  <packaging>jar</packaging>

  <name>cpt_migrations</name>
  <url>http://maven.apache.org</url>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>

  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>mysql</groupId>
        <artifactId>mysql-connector-java</artifactId>
        <version>5.1.24</version>
    </dependency>
  </dependencies>
  <build>
      <plugins>
          <plugin>
              <groupId>com.googlecode.flyway</groupId>
              <artifactId>flyway-maven-plugin</artifactId>
              <version>2.1.1</version>
              <configuration>
                  <user>root</user>
                  <password></password>
                  <driver>com.mysql.jdbc.Driver</driver>
                  <url>jdbc:mysql://localhost:3306/cpt</url>
              </configuration>
          </plugin>
      </plugins>
  </build>
</project>
Run Code Online (Sandbox Code Playgroud)

我的文件夹结构是规定的PROJECT_ROOT/src/main/resources/db/migration/V1__Base_version.sql:

当我从PROJECT_ROOT执行时,我得到错误:mvn flyway:migrate

Axe*_*ine 16

不要忘记先调用编译,以确保复制资源.


ian*_*naz 5

在我的情况下,我必须明确设置

flyway.locations=classpath:db/migration
Run Code Online (Sandbox Code Playgroud)

在我的 application.properties (Spring Boot) 中让它工作。

  • 设置在哪里?不要以为每个人都是这些事情的专家! (2认同)