'Liquibase using H2 getting Driver class was not specified and MVMap$2 error

When I execute: ./mvnw liquibase:diff

I am getting errors: Driver class was not specified and ClassNotFoundException: org.h2.mvstore.MVMap$2:

[ERROR] Failed to execute goal org.liquibase:liquibase-maven-plugin:4.3.2:diff (default-cli) on project app: 
[ERROR] Error setting up or running Liquibase:
[ERROR] liquibase.exception.DatabaseException: java.lang.RuntimeException: Driver class was not specified and could not be determined from the url (hibernate:spring:com.my.app.domain?dialect=org.hibernate.dialect.H2Dialect)
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
Exception in thread "Thread-1" java.lang.NoClassDefFoundError: org/h2/mvstore/MVMap$2
    at org.h2.mvstore.MVMap.entrySet(MVMap.java:793)
    at org.h2.mvstore.db.LobStorageMap.removeAllForTable(LobStorageMap.java:302)
    at org.h2.engine.Database.removeOrphanedLobs(Database.java:1489)
    at org.h2.engine.Database.closeImpl(Database.java:1416)
    at org.h2.engine.Database.close(Database.java:1373)
    at org.h2.engine.OnExitDatabaseCloser.onShutdown(OnExitDatabaseCloser.java:85)
    at org.h2.engine.OnExitDatabaseCloser.run(OnExitDatabaseCloser.java:114)
Caused by: java.lang.ClassNotFoundException: org.h2.mvstore.MVMap$2
    at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50)
    at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass(ClassRealm.java:271)
    at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:247)
    at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:239)
    ... 7 more

Here is my pom.xml:

<build>
    <defaultGoal>spring-boot:run</defaultGoal>
    <plugins>
        <plugin>
            <groupId>org.liquibase</groupId>
            <artifactId>liquibase-maven-plugin</artifactId>
        </plugin>
        ...
    </plugins>
    <pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.liquibase</groupId>
                <artifactId>liquibase-maven-plugin</artifactId>
                <version>${liquibase.version}</version>
                <configuration>
                    <changeLogFile>${project.basedir}/src/main/resources/config/liquibase/master.xml</changeLogFile>
                    <diffChangeLogFile>${project.basedir}/src/main/resources/config/liquibase/changelog/${maven.build.timestamp}_changelog.xml</diffChangeLogFile>
                    <driver>org.h2.Driver</driver>
                    <url>jdbc:h2:file:${project.build.directory}/h2db/db/app</url>
                    <defaultSchemaName></defaultSchemaName>
                    <username>app</username>
                    <password></password>
                    <referenceUrl>hibernate:spring:com.my.app.domain?dialect=org.hibernate.dialect.H2Dialect</referenceUrl>
                    <verbose>true</verbose>
                    <logging>debug</logging>
                    <contexts>!test</contexts>
                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>org.liquibase.ext</groupId>
                        <artifactId>liquibase-hibernate5</artifactId>
                        <version>3.6</version>
                    </dependency>
                    <dependency>
                        <groupId>com.h2database</groupId>
                        <artifactId>h2</artifactId>
                        <version>1.4.200</version>
                    </dependency>
                </dependencies>
            </plugin>


Solution 1:[1]

I see you have not added the driver (relative) path to the driver tag. Have a look at this article: https://docs.liquibase.com/concepts/basic/liquibase-relative-path-best-practices.html

Solution 2:[2]

I got this from a corrupted dependency - deleting ~/.gradle and re-running fixed the issue.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Aditi
Solution 2 tschumann