简体   繁体   中英

How to point to custom folder in configuration block in pom.xml file

I have application.properties in /etc folder like this: etc/project/application.properties , but I can't find a way how to point to it inside pom.xml configuration section.

So far I have:

   <build>
        <plugins>
            <plugin>
                <groupId>org.flywaydb</groupId>
                <artifactId>flyway-maven-plugin</artifactId>
                <version>8.0.5</version>
                <configuration>
                    <driver>org.postgresql.Driver</driver>
                    <configFiles>
                        <configFile>/etc/project/application.properties</configFile> //<-- does not work!
                    </configFiles>
                </configuration>
     ...

any help?

accroding to flyway maven plugin's official doc: flyway maven plugin doc

you can supplying the System property flyway.configFiles as follows:

$ mvn -Dflyway.configFiles=path/to/myAlternativeConfig.conf flyway:migrate

or use the FLYWAY_CONFIG_FILES environment variable

See Flyway Maven plugin, Config files :

It is also possible to point Flyway at one or more additional config files. This is achieved by supplying the System property flyway.configFiles as follows:

 $ mvn -Dflyway.configFiles=path/to/myAlternativeConfig.conf flyway:migrate

To pass in multiple files, separate their names with commas:

 $ mvn -Dflyway.configFiles=path/to/myAlternativeConfig.conf,other.conf flyway:migrate

So, contrary to the usual Maven convention configFiles is the name of the property, not a collection of properties:

                <configuration>
                    <driver>org.postgresql.Driver</driver>
                    <flyway.configFiles>/etc/project/application.properties</flyway.configFiles>  <!-- this should work -->
                    <!-- <configFiles>/etc/project/application.properties</configFiles> -->  <!-- or this -->
                </configuration>

If neither works try:

    <properties>
        <flyway.configFiles>/etc/project/application.properties</flyway.configFiles>
    <properties>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM