Matheus208
Matheus208

Reputation: 1439

mvn liquibase:update results in "Failed to resolve the properties file."

When i run mvn liquibase:update, i get these on the 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

Which suggests me that it has found my properties file and ran it successfully (the database is updated as well).

However, the command fails with this reason:

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

(And, this being Java, Help 1 is no help at all. All it says it's a MojoFailureException, of course.)

My POM has this as a dependency:

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

And this is where I configure the plugin:

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

On my liquibase.yaml file:

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

On the db.changelog-master.yaml:

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

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

So... what could be giving the "Failed to resolve properties file?"

Upvotes: 3

Views: 10009

Answers (1)

Matheus208
Matheus208

Reputation: 1439

Okay, the probem was: I was trying to configure the plugin on my root pom.xml, but I also had two submodules. One had the liquibase.yaml file, the other didn't.

That way, when I ran mvn liquibase:update on the parent project, it would successfully run the migration on the first module but would fail on the second, giving me the output above...

Upvotes: 4

Related Questions