简体   繁体   English

如何指向 pom.xml 文件中配置块中的自定义文件夹

[英]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.我在 /etc 文件夹中有application.properties ,如下所示: etc/project/application.properties ,但我找不到如何在 pom.xml 配置部分中指向它的方法。

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根据flyway maven插件的官方文档: flyway maven plugin doc

you can supplying the System property flyway.configFiles as follows:您可以按如下方式提供系统属性 flyway.configFiles:

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

or use the FLYWAY_CONFIG_FILES environment variable或使用 FLYWAY_CONFIG_FILES 环境变量

See Flyway Maven plugin, Config files :请参阅Flyway Maven 插件,配置文件

It is also possible to point Flyway at one or more additional config files.也可以将 Flyway 指向一个或多个附加配置文件。 This is achieved by supplying the System property flyway.configFiles as follows:这是通过提供系统属性flyway.configFiles来实现的,如下所示:

 $ 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:因此,与通常的 Maven 约定相反, configFiles是属性的名称,而不是属性的集合:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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