diff --git a/bom/application/pom.xml b/bom/application/pom.xml
index 78d358cf178cc..b7b50d518b3fc 100644
--- a/bom/application/pom.xml
+++ b/bom/application/pom.xml
@@ -159,7 +159,7 @@
1.0.0
1.8.21
1.6.4
- 1.5.0
+ 1.5.1
3.6.0
3.2.0
4.2.0
diff --git a/core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/NativeImageBuildRunnerDummy.java b/core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/NativeImageBuildRunnerDummy.java
new file mode 100644
index 0000000000000..63ac4411aea39
--- /dev/null
+++ b/core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/NativeImageBuildRunnerDummy.java
@@ -0,0 +1,34 @@
+package io.quarkus.deployment.pkg.steps;
+
+import java.nio.file.Path;
+import java.util.List;
+
+public class NativeImageBuildRunnerDummy extends NativeImageBuildRunner {
+
+ private static final String MESSAGE = "NativeImageBuildRunnerDummy is note meant to be used to perform an actual build.";
+ private final boolean isContainer;
+
+ public NativeImageBuildRunnerDummy(boolean isContainer) {
+ this.isContainer = isContainer;
+ }
+
+ @Override
+ public boolean isContainer() {
+ return isContainer;
+ }
+
+ @Override
+ protected String[] getGraalVMVersionCommand(List args) {
+ throw new RuntimeException(MESSAGE);
+ }
+
+ @Override
+ protected String[] getBuildCommand(Path outputDir, List args) {
+ throw new RuntimeException(MESSAGE);
+ }
+
+ @Override
+ protected void objcopy(Path outputDir, String... args) {
+ throw new RuntimeException(MESSAGE);
+ }
+}
diff --git a/core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/NativeImageBuildStep.java b/core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/NativeImageBuildStep.java
index e4c313fcb650f..3885c3bb73598 100644
--- a/core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/NativeImageBuildStep.java
+++ b/core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/NativeImageBuildStep.java
@@ -329,7 +329,7 @@ private String getResultingExecutableName(String nativeImageName, boolean isCont
/**
* Resolves the runner factory. Happens quite early, *before* the build.
*/
- @BuildStep
+ @BuildStep(onlyIf = NativeBuild.class)
public NativeImageRunnerBuildItem resolveNativeImageBuildRunner(NativeConfig nativeConfig) {
boolean isExplicitContainerBuild = nativeConfig.containerBuild()
.orElse(nativeConfig.containerRuntime().isPresent() || nativeConfig.remoteContainerBuild());
@@ -353,6 +353,16 @@ public NativeImageRunnerBuildItem resolveNativeImageBuildRunner(NativeConfig nat
return new NativeImageRunnerBuildItem(new NativeImageBuildLocalContainerRunner(nativeConfig));
}
+ /**
+ * Creates a dummy runner for native-sources builds. This allows the creation of native-source jars without
+ * requiring podman/docker or a local native-image installation.
+ */
+ @BuildStep(onlyIf = NativeSourcesBuild.class)
+ public NativeImageRunnerBuildItem dummyNativeImageBuildRunner(NativeConfig nativeConfig) {
+ boolean explicitContainerBuild = nativeConfig.isExplicitContainerBuild();
+ return new NativeImageRunnerBuildItem(new NativeImageBuildRunnerDummy(explicitContainerBuild));
+ }
+
private void copyJarSourcesToLib(OutputTargetBuildItem outputTargetBuildItem,
CurateOutcomeBuildItem curateOutcomeBuildItem) {
Path targetDirectory = outputTargetBuildItem.getOutputDirectory()
diff --git a/docs/src/main/asciidoc/building-native-image.adoc b/docs/src/main/asciidoc/building-native-image.adoc
index 8620002a85b7a..3e0243d52d816 100644
--- a/docs/src/main/asciidoc/building-native-image.adoc
+++ b/docs/src/main/asciidoc/building-native-image.adoc
@@ -786,10 +786,11 @@ $ ./mvnw clean package -Dquarkus.package.type=native-sources -Dquarkus.native.co
cd target/native-sources
docker run \
-it \
+ --user $(id -ur):$(id -gr) \
--rm \
- --v $(pwd):/work \# <1>
+ -v $(pwd):/work \# <1>
-w /work \# <2>
- --entrypoint bin/sh \
+ --entrypoint /bin/sh \
$(cat native-builder.image) \# <3>
-c "native-image $(cat native-image.args) -J-Xmx4g"# <4>
----