mvn liquibase:更新结果“无法解析属性文件”。

时间:2016-09-20 12:47:15

标签: java maven liquibase

当我运行mvn liquibase:update时,我会在stdout上找到这些:

[INFO] Executing on Database: jdbc:postgresql://localhost:5432/PROJECT_NAME
INFO 20/09/16 09:41:liquibase: null: null: Successfully acquired change log lock
INFO 20/09/16 09:41:liquibase: null: null: Creating database history table with name: databasechangelog
INFO 20/09/16 09:41:liquibase: null: null: Reading from databasechangelog
INFO 20/09/16 09:41:liquibase: null: null: Reading from databasechangelog
INFO 20/09/16 09:41:liquibase: PROJECT_NAME/src/main/resources/db/changelog/db.changelog-master.yaml: PROJECT_NAME/src/main/resources/db/changelog/db.changelog-1.0.yaml::1::matheus.serpellone: Table PERMISSIONS created
INFO 20/09/16 09:41:liquibase: PROJECT_NAME/src/main/resources/db/changelog/db.changelog-master.yaml: PROJECT_NAME/src/main/resources/db/changelog/db.changelog-1.0.yaml::1::matheus.serpellone: ChangeSet PROJECT_NAME/src/main/resources/db/changelog/db.changelog-1.0.yaml::1::matheus.serpellone ran successfully in 22ms
INFO 20/09/16 09:41:liquibase: PROJECT_NAME/src/main/resources/db/changelog/db.changelog-master.yaml: null: Successfully released change log lock

这表明我已找到我的属性文件并成功运行它(数据库也已更新)。

但是,该命令因此失败:

[ERROR] Failed to execute goal org.liquibase:liquibase-maven-plugin:3.0.5:update (default-cli) on project PROJECT_NAME: Failed to resolve the properties file. -> [Help 1]

(而且,这是Java,帮助1根本没有任何帮助。当然,它只是说MojoFailureException。)

我的POM将此视为依赖:

<!-- Liquid Base -->
<dependency>
    <groupId>org.liquibase</groupId>
    <artifactId>liquibase-maven-plugin</artifactId>
    <version>3.5.1</version>
</dependency>

这是我配置插件的地方:

<build>
    <plugins>
        <plugin>
            <groupId>org.liquibase</groupId>
            <artifactId>liquibase-maven-plugin</artifactId>
            <version>3.0.5</version>
            <configuration>
                <propertyFile>PROJECT_NAME/src/main/resources/db/changelog/liquibase.yaml</propertyFile>
            </configuration>
        </plugin>
    </plugins>
</build>

在我的liquibase.yaml文件中:

driver: org.postgresql.Driver
classpath: ./lib/postgresql-9.2-1002-jdbc4.jar
url: jdbc:postgresql://localhost:5432/ifood_extranet_bff
username: xxx
password: xxx
changeLogFile: PATH_NAME/src/main/resources/db/changelog/db.changelog-master.yaml

在db.changelog-master.yaml:

databaseChangeLog:
- include:
    file: extranet-bff-core/src/main/resources/db/changelog/db.changelog-1.0.yaml

db.changelog-1.0.yaml:     ---     databaseChangeLog:       - changeSet:         id:1         作者:matheus.serpellone         变化:            - createTable:               tableName:PERMISSIONS               列:                  - 专栏:                     名称:ID                     类型:bigint                     autoIncrement:true                     限制:                       primaryKey:是的                       可空的:虚假的                  - 专栏:                     名称:角色                     类型:Varchar(255)                     限制:                       可空的:虚假的                  - 专栏:                     名称:PERMISSION                     类型:Varchar(255)                     限制:                       可空的:虚假的     ...

那么......什么可能会给“无法解析属性文件?”

1 个答案:

答案 0 :(得分:2)

好的,探测器是:我试图在我的root pom.xml上配置插件,但我也有两个子模块。一个有liquibase.yaml文件,另一个没有。

这样,当我在父项目上运行zipping时,它会在第一个模块上成功运行迁移,但在第二个模块上会失败,给我上面的输出...