This is an automated email from the ASF dual-hosted git repository.

gfournier pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git


The following commit(s) were added to refs/heads/main by this push:
     new 36a2b9d622 Fix #8481. Fix mina-sftp native compilation for GraalVM 21
36a2b9d622 is described below

commit 36a2b9d6221a0f2dea888df01464c61b72cf7caf
Author: jomin mathew <>
AuthorDate: Mon Mar 30 10:03:47 2026 +0100

    Fix #8481. Fix mina-sftp native compilation for GraalVM 21
---
 .../component/mina/sftp/deployment/MinaSftpProcessor.java   | 13 +++++++++++++
 .../mina/sftp/graal/SftpFileSystemProviderSubstitution.java |  5 +++++
 2 files changed, 18 insertions(+)

diff --git 
a/extensions/mina-sftp/deployment/src/main/java/org/apache/camel/quarkus/component/mina/sftp/deployment/MinaSftpProcessor.java
 
b/extensions/mina-sftp/deployment/src/main/java/org/apache/camel/quarkus/component/mina/sftp/deployment/MinaSftpProcessor.java
index 4100ceba33..8e68d77530 100644
--- 
a/extensions/mina-sftp/deployment/src/main/java/org/apache/camel/quarkus/component/mina/sftp/deployment/MinaSftpProcessor.java
+++ 
b/extensions/mina-sftp/deployment/src/main/java/org/apache/camel/quarkus/component/mina/sftp/deployment/MinaSftpProcessor.java
@@ -16,10 +16,14 @@
  */
 package org.apache.camel.quarkus.component.mina.sftp.deployment;
 
+import java.util.Set;
+
 import io.quarkus.deployment.annotations.BuildProducer;
 import io.quarkus.deployment.annotations.BuildStep;
 import io.quarkus.deployment.builditem.FeatureBuildItem;
+import io.quarkus.deployment.builditem.RemovedResourceBuildItem;
 import 
io.quarkus.deployment.builditem.nativeimage.RuntimeInitializedClassBuildItem;
+import io.quarkus.maven.dependency.ArtifactKey;
 import org.apache.camel.quarkus.core.deployment.spi.CamelServiceFilter;
 import 
org.apache.camel.quarkus.core.deployment.spi.CamelServiceFilterBuildItem;
 
@@ -40,6 +44,15 @@ class MinaSftpProcessor {
         serviceFilter.produce(new 
CamelServiceFilterBuildItem(CamelServiceFilter.forComponent("sftp")));
     }
 
+    @BuildStep
+    RemovedResourceBuildItem removeFileSystemProviderService() {
+        // Remove the FileSystemProvider service file from sshd-sftp to 
prevent ServiceLoader
+        // from finding SftpFileSystemProvider which is marked with @Delete
+        return new RemovedResourceBuildItem(
+                ArtifactKey.fromString("org.apache.sshd:sshd-sftp"),
+                
Set.of("META-INF/services/java.nio.file.spi.FileSystemProvider"));
+    }
+
     @BuildStep
     void 
runtimeInitializedClasses(BuildProducer<RuntimeInitializedClassBuildItem> 
runtimeInitializedClass) {
         // FTP/FTPS/SFTP endpoint classes are still on the classpath (from 
camel-ftp)
diff --git 
a/extensions/mina-sftp/runtime/src/main/java/org/apache/camel/quarkus/component/mina/sftp/graal/SftpFileSystemProviderSubstitution.java
 
b/extensions/mina-sftp/runtime/src/main/java/org/apache/camel/quarkus/component/mina/sftp/graal/SftpFileSystemProviderSubstitution.java
index e6a7eb1317..a7617c3a40 100644
--- 
a/extensions/mina-sftp/runtime/src/main/java/org/apache/camel/quarkus/component/mina/sftp/graal/SftpFileSystemProviderSubstitution.java
+++ 
b/extensions/mina-sftp/runtime/src/main/java/org/apache/camel/quarkus/component/mina/sftp/graal/SftpFileSystemProviderSubstitution.java
@@ -19,6 +19,11 @@ package org.apache.camel.quarkus.component.mina.sftp.graal;
 import com.oracle.svm.core.annotate.Delete;
 import com.oracle.svm.core.annotate.TargetClass;
 
+/**
+ * SftpFileSystemProvider is not needed by mina-sftp component.
+ * However, it's referenced via ServiceLoader at build time, causing conflicts.
+ * We mark it as @Delete to remove it from the native image.
+ */
 @TargetClass(className = 
"org.apache.sshd.sftp.client.fs.SftpFileSystemProvider")
 @Delete
 final class SftpFileSystemProviderSubstitution {

Reply via email to