Arthur Eirich
Arthur Eirich

Reputation: 3658

org.hibernate.boot.registry.selector.spi.StrategySelectionException when trying to run liquibase-diff with maven plugin

Wheny trying to run a liquibase-diff maven profile in a Spring Boot project the following error occurs:

Failed to execute goal org.liquibase:liquibase-maven-plugin:4.24.0:diff (default) on project projectName: 
Error setting up or running Liquibase:
org.hibernate.boot.registry.selector.spi.StrategySelectionException: Unable to resolve name [org.springframework.boot.orm.jpa.hibernate.CamelCaseToUnderscoresNamingStrategy] as strategy [org.hibernate.boot.model.naming.PhysicalNamingStrategy]

Here is the snippet of the maven profile:

<plugin>
    <groupId>org.liquibase</groupId>
    <artifactId>liquibase-maven-plugin</artifactId>
    <version>${liquibase.version}</version>
    <configuration>
        <propertyFile>liquibase-h2.properties</propertyFile>
        <searchPath>${project.build.outputDirectory}/db</searchPath>
    </configuration>
    <executions>
        <execution>
            <phase>verify</phase>
            <goals>
                <goal>diff</goal>
            </goals>
        </execution>
    </executions>
    <dependencies>
        <dependency>
            <groupId>org.liquibase.ext</groupId>
            <artifactId>liquibase-hibernate6</artifactId>
            <version>${liquibase.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
            <version>${spring-boot.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-validation</artifactId>
            <version>${spring-boot.version}</version>
        </dependency>
        <dependency>
            <groupId>de.nds.sla.evok</groupId>
            <artifactId>evok-mobil-core</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-spatial</artifactId>
            <version>${hibernate.version}</version>
        </dependency>
        <dependency>
            <groupId>com.h2database</groupId>
            <artifactId>h2</artifactId>
            <version>${h2.version}</version>
        </dependency>
    </dependencies>
</plugin>

Here is the liquibase-h2.properties content:

changeLogFile=classpath:db/changelog/db.changelog-master.xml
url=jdbc:h2:file:~/projectRoot/subPath;AUTO_SERVER=TRUE;CIPHER=AES;
username=someUsername
password=somePwd
driver=org.h2.Driver
referenceUrl=hibernate:spring:path.of.the.project?\
&hibernate.physical_naming_strategy=org.springframework.boot.orm.jpa.hibernate.CamelCaseToUnderscoresNamingStrategy\
&hibernate.implicit_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy\
  &hibernate.id.new_generator_mappings=true
diffChangeLogFile=src/main/resources/db/liquibase-changelog-diff.xml
liquibase.hub.mode=off

Spring Boot is version 3.2.3, Hibernates version is 6.4.4.Final and H2's version is 2.2.224. So far I couldn't find any similar questions/answers. How can I get this running?

Upvotes: 0

Views: 66

Answers (0)

Related Questions