Quarkus Maven Plugin unable to handle maven exclusions
### Describe the bug

One of the artifacts in my POM has `ehcache` as a dependency, but when I'm trying to exclude it as follows:
```
        <dependency>
            <groupId>io.quarkiverse.cxf</groupId>
            <artifactId>quarkus-cxf-rt-ws-security</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>org.ehcache</groupId>
                    <artifactId>ehcache</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
```
I'm getting this error:
```
[ERROR]         [error]: Build step io.quarkus.deployment.index.ApplicationArchiveBuildStep#build threw an exception: java.lang.RuntimeException: Could not resolve artifact org.ehcache:ehcache::jar among the runtime dependencies of the application
[ERROR]         at io.quarkus.deployment.index.ApplicationArchiveBuildStep.addIndexDependencyPaths(ApplicationArchiveBuildStep.java:188)
[ERROR]         at io.quarkus.deployment.index.ApplicationArchiveBuildStep.scanForOtherIndexes(ApplicationArchiveBuildStep.java:151)
[ERROR]         at io.quarkus.deployment.index.ApplicationArchiveBuildStep.build(ApplicationArchiveBuildStep.java:108)
[ERROR]         at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[ERROR]         at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[ERROR]         at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[ERROR]         at java.base/java.lang.reflect.Method.invoke(Method.java:567)
[ERROR]         at io.quarkus.deployment.ExtensionLoader$3.execute(ExtensionLoader.java:909)
[ERROR]         at io.quarkus.builder.BuildContext.run(BuildContext.java:281)
[ERROR]         at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
[ERROR]         at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2449)
[ERROR]         at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1478)
[ERROR]         at java.base/java.lang.Thread.run(Thread.java:835)
[ERROR]         at org.jboss.threads.JBossThread.run(JBossThread.java:501)
[ERROR] -> [Help 1]
```

Is it a known bug?

I tried to downgrade to the older version (from 2.13.0.Final to 2.12.1.Final) and it worked, so it must be a regression.

### Expected behavior

Successful build without an error.

### Actual behavior

Plugin throws java.lang.RuntimeException.

### How to Reproduce?

_No response_

### Output of `uname -a` or `ver`

_No response_

### Output of `java -version`

_No response_

### GraalVM version (if different from Java)

_No response_

### Quarkus version or git rev

_No response_

### Build tool (ie. output of `mvnw --version` or `gradlew --version`)

_No response_

### Additional information

_No response_
diff --git a/core/deployment/src/main/java/io/quarkus/deployment/index/ApplicationArchiveBuildStep.java b/core/deployment/src/main/java/io/quarkus/deployment/index/ApplicationArchiveBuildStep.java
index 89f62b23054..cb4b7289fe2 100644
--- a/core/deployment/src/main/java/io/quarkus/deployment/index/ApplicationArchiveBuildStep.java
+++ b/core/deployment/src/main/java/io/quarkus/deployment/index/ApplicationArchiveBuildStep.java
@@ -6,7 +6,6 @@
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.util.ArrayList;
-import java.util.Collection;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
@@ -168,35 +167,28 @@ private void addIndexDependencyPaths(List<IndexDependencyBuildItem> indexDepende
         if (indexDependencyBuildItems.isEmpty()) {
             return;
         }
-        final Collection<ResolvedDependency> userDeps = curateOutcomeBuildItem.getApplicationModel()
-                .getRuntimeDependencies();
-        final Map<ArtifactKey, ResolvedDependency> userMap = new HashMap<>(userDeps.size());
-        for (ResolvedDependency dep : userDeps) {
-            userMap.put(dep.getKey(), dep);
+        final Set<ArtifactKey> indexDependencyKeys = new HashSet<>(indexDependencyBuildItems.size());
+        for (IndexDependencyBuildItem indexDependencyBuildItem : indexDependencyBuildItems) {
+            indexDependencyKeys.add(ArtifactKey.of(indexDependencyBuildItem.getGroupId(),
+                    indexDependencyBuildItem.getArtifactId(),
+                    indexDependencyBuildItem.getClassifier(),
+                    ArtifactCoords.TYPE_JAR));
         }
-        try {
-            for (IndexDependencyBuildItem indexDependencyBuildItem : indexDependencyBuildItems) {
-                final ArtifactKey key = ArtifactKey.of(indexDependencyBuildItem.getGroupId(),
-                        indexDependencyBuildItem.getArtifactId(),
-                        indexDependencyBuildItem.getClassifier(),
-                        ArtifactCoords.TYPE_JAR);
-                final ResolvedDependency artifact = userMap.get(key);
-                if (artifact == null) {
-                    throw new RuntimeException(
-                            "Additional dependency to be indexed (added via 'quarkus.index-dependency' configuration) "
-                                    + key
-                                    + " could not be found among the runtime dependencies of the application. Either remove the indexing configuration or add the dependency to your build system.");
-                }
-                for (Path path : artifact.getContentTree().getRoots()) {
-                    if (!root.isExcludedFromIndexing(path) && !root.getResolvedPaths().contains(path)
+        for (ResolvedDependency dep : curateOutcomeBuildItem.getApplicationModel().getDependencies()) {
+            if (dep.isRuntimeCp() && indexDependencyKeys.contains(dep.getKey())) {
+                for (Path path : dep.getContentTree().getRoots()) {
+                    if (!root.isExcludedFromIndexing(path)
+                            && !root.getResolvedPaths().contains(path)
                             && indexedDeps.add(path)) {
-                        appArchives.add(createApplicationArchive(buildCloseables, indexCache, path, key,
-                                removedResources));
+                        try {
+                            appArchives.add(createApplicationArchive(buildCloseables, indexCache, path, dep.getKey(),
+                                    removedResources));
+                        } catch (IOException e) {
+                            throw new UncheckedIOException(e);
+                        }
                     }
                 }
             }
-        } catch (IOException e) {
-            throw new RuntimeException(e);
         }
     }
 
['core/deployment/src/main/java/io/quarkus/deployment/index/ApplicationArchiveBuildStep.java']