当我运行 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 author:matheus.serpellone changes: - createTable:tableName:PERMISSIONS columns: - column:name:ID type:bigint autoIncrement:true constraints:primaryKey :true nullable:false - column:name:ROLE type:varchar(255)constraints:nullable:false - column:name:PERMISSION type:varchar(255)constraints:nullable:false ...
那么......什么可能会给“无法解析属性文件?”
1 回答
好吧,探测器是:我试图在我的root pom.xml上配置插件,但我也有两个子模块 . 一个有liquibase.yaml文件,另一个没有 .
这样,当我在父项目上运行
mvn liquibase:update
时,它会在第一个模块上成功运行迁移,但在第二个模块上会失败,给我上面的输出...