1

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 

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>

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

Sávio Raires
  • 159
  • 2
  • 5
  • 11
  • What you need to is override the maven plugin's config value at runtime. Pls check this: https://stackoverflow.com/questions/35048422/override-maven-plugin-parameters – SudhirR Dec 11 '19 at 07:39

1 Answers1

7

Hope you have figured it out by now. But this answer might help others.

the error posted is this:

org.flywaydb.core.api.FlywayException: Unknown configuration property: flyway.configFile

That's because there is an "s" missing. It should be flyway.configFiles

Note: it ends with an "s"

And as per the flyway documentation, below is the right way to use it (with -D flag)

mvn flyway:repair -Dflyway.configFiles=path/to/myConfigFile.conf 
dp119
  • 91
  • 1
  • 6