diff --git a/extensions/jdbc/jdbc-h2/runtime/pom.xml b/extensions/jdbc/jdbc-h2/runtime/pom.xml
index af1b7833ba93b..ef1752782a3aa 100644
--- a/extensions/jdbc/jdbc-h2/runtime/pom.xml
+++ b/extensions/jdbc/jdbc-h2/runtime/pom.xml
@@ -52,6 +52,9 @@
com.h2database:h2
+
+ io.quarkus.jdbc.h2
+
diff --git a/extensions/liquibase/deployment/src/main/java/io/quarkus/liquibase/deployment/LiquibaseProcessor.java b/extensions/liquibase/deployment/src/main/java/io/quarkus/liquibase/deployment/LiquibaseProcessor.java
index 818e6529ed24e..66e45af582ff9 100644
--- a/extensions/liquibase/deployment/src/main/java/io/quarkus/liquibase/deployment/LiquibaseProcessor.java
+++ b/extensions/liquibase/deployment/src/main/java/io/quarkus/liquibase/deployment/LiquibaseProcessor.java
@@ -16,6 +16,7 @@
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.function.BiConsumer;
+import java.util.function.Predicate;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@@ -36,6 +37,7 @@
import io.quarkus.arc.deployment.SyntheticBeanBuildItem;
import io.quarkus.arc.processor.DotNames;
import io.quarkus.datasource.common.runtime.DataSourceUtil;
+import io.quarkus.deployment.Capabilities;
import io.quarkus.deployment.Feature;
import io.quarkus.deployment.annotations.BuildProducer;
import io.quarkus.deployment.annotations.BuildStep;
@@ -101,6 +103,7 @@ void nativeImageConfiguration(
LiquibaseBuildTimeConfig liquibaseBuildConfig,
List jdbcDataSourceBuildItems,
CombinedIndexBuildItem combinedIndex,
+ Capabilities capabilities,
BuildProducer reflective,
BuildProducer resource,
BuildProducer services,
@@ -212,7 +215,7 @@ void nativeImageConfiguration(
// CommandStep implementations are needed
consumeService(liquibase.command.CommandStep.class, (serviceClass, implementations) -> {
var filteredImpls = implementations.stream()
- .filter(not("liquibase.command.core.StartH2CommandStep"::equals))
+ .filter(commandStepPredicate(capabilities))
.toArray(String[]::new);
services.produce(new ServiceProviderBuildItem(serviceClass.getName(), filteredImpls));
reflective.produce(ReflectiveClassBuildItem.builder(filteredImpls).constructors().build());
@@ -250,6 +253,14 @@ void nativeImageConfiguration(
resourceBundle.produce(new NativeImageResourceBundleBuildItem("liquibase/i18n/liquibase-core"));
}
+ private static Predicate commandStepPredicate(Capabilities capabilities) {
+ if (capabilities.isPresent("io.quarkus.jdbc.h2")) {
+ return (s) -> true;
+ } else {
+ return not("liquibase.command.core.StartH2CommandStep"::equals);
+ }
+ }
+
private void consumeService(Class> serviceClass, BiConsumer, Collection> consumer) {
try {
String service = "META-INF/services/" + serviceClass.getName();