Flyway Maven Plugin Execute GOLS from external Config File

Sáv*_*res 1 java postgresql spring flyway spring-boot

Guys I'm using flyway on a spring boot project.

When I start the application the migration scripts are executed correctly.

My migrations are in the folder:

flyway.locations = db / migration / postgresql

The problem occurs when I try to execute some purpose of fyway plugin maven from a configuration file.

Configuration File:

flyway.password=root
flyway.schemas=public
flyway.url=jdbc:postgresql://localhost:5432/film
flyway.locations=db/migration/postgresql 
Run Code Online (Sandbox Code Playgroud)

Running the maven command:

mvn flyway: repair -Flyway.config File = myFlywayConfig.properties

Returns the error:

Failed to execute goal org.flywaydb:flyway-maven-plugin:6.1.0:repair (default-cli) on project demo-hibernate-envers: org.flywaydb.core.api.FlywayException: Unknown configuration property: flyway.configFile

However when I configure flyway plugin via pom.xml and run the command:

mvn flyway:repair

Everything is ok

Below the flyway plugin configuration:

           <plugin>
                <groupId>org.flywaydb</groupId>
                <artifactId>flyway-maven-plugin</artifactId>
                <version>6.1.0</version>
                <dependencies>
                    <dependency>
                        <groupId>org.postgresql</groupId>
                        <artifactId>postgresql</artifactId>
                        <version>42.2.5</version>
                        <scope>runtime</scope>
                    </dependency>
                </dependencies>
                <configuration>
                    <user>postgres</user>
                    <password>root</password>
                    <url>jdbc:postgresql://localhost:5432/film</url>
                    <schemas>
                        <schema>public</schema>
                    </schemas>
                </configuration>
            </plugin>
Run Code Online (Sandbox Code Playgroud)

Does anyone know how to do to accomplish the goals of the flyway plugin based on external configuration?

dp1*_*119 6

希望你现在已经想通了。但这个答案可能会帮助其他人。

发布的错误是这样的:

org.flywaydb.core.api.FlywayException: Unknown configuration property: flyway.configFile
Run Code Online (Sandbox Code Playgroud)

那是因为缺少一个“s”。应该是 flyway.configFile s

注意:它以“s”结尾

根据 flyway 文档,下面是使用它的正确方法(带有 -D 标志)

mvn flyway:repair -Dflyway.configFiles=path/to/myConfigFile.conf 
Run Code Online (Sandbox Code Playgroud)