I have setup a spring boot project (parent) with 3 modules inside.
-- parent
--module 1
--module 2
--module 3
Now i would like to add a new maven project as a new module to this parent project.
The new maven project is using the liquibase-maven-plugin and works perfect as a single project. But when i try to integrate the new maven project to the parent project it fails.
Failed to execute goal org.liquibase:liquibase-maven-plugin:3.5.3:update (default)
on project database-migration: Error setting up or running Liquibase:
liquibase.exception.DatabaseException: liquibase.exception.DatabaseException:
Connection could not be created to ${database.url} with driver org.postgresql.Driver.
Possibly the wrong driver for the given database URL
The liquibase-maven-plugin is not able anymore to replace the placeholder ${database.url}
definied in the liquibase.properties
file, when i add this parent section to my new module project:
<parent>
<artifactId>backend-parent</artifactId>
<groupId>xyz</groupId>
<version>0.1.0-SNAPSHOT</version>
</parent>
The parent / super POM looks like:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>xyz</groupId>
<artifactId>backend-parent</artifactId>
<packaging>pom</packaging>
<version>0.1.0-SNAPSHOT</version>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.0.RELEASE</version>
</parent>
<modules>
<module>api</module>
<module>db</module>
<module>business</module>
<module>migration</module>
</modules>
<properties>
<java.version>9</java.version>
<start-class>xyz.Application</start-class>
<postgresql.version>42.2.1</postgresql.version>
<h2.database.version>1.4.197</h2.database.version>
...
</<properties>
<dependencies>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>${jaxb.api.version}</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok.version}</version>
<scope>provided</scope>
</dependency>
The new module POM:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>backend-parent</artifactId>
<groupId>xyz</groupId>
<version>0.1.0-SNAPSHOT</version>
</parent>
<artifactId>migration</artifactId>
<properties>
<liquibase.maven.plugin.version>3.5.3</liquibase.maven.plugin.version>
<postgresql.version>42.2.1</postgresql.version>
<env>local</env>
</properties>
<profiles>
<profile>
<id>update-db</id>
<build>
<filters>
<filter>${project.basedir}/src/main/resources/filters/${env}/database.properties</filter>
</filters>
<resources>
<resource>
<directory>src/main/resources/liquibase/</directory>
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-maven-plugin</artifactId>
<version>${liquibase.maven.plugin.version}</version>
<configuration>
<changeLogFile>src/main/resources/liquibase/changelog-master.xml</changeLogFile>
<propertyFile>target/classes/liquibase.properties</propertyFile>
<promptOnNonLocalDatabase>true</promptOnNonLocalDatabase>
<driver>org.postgresql.Driver</driver>
<logging>debug</logging>
</configuration>
<dependencies>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>${postgresql.version}</version>
</dependency>
</dependencies>
<executions>
<execution>
<phase>process-resources</phase>
<goals>
<goal>update</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
in liquibase.properties
url: ${database.url}
username: ${database.username}
verbose: true
contexts: ${environment}
As i said works fine without the parent section in the new module POM. I use this cmd to build the migration.
mvn clean install -Pupdate-db -Denv=local
I did tried serveral workarounds described here:
Thank you for any advise.