Source:
protected Set<BundleDependency> resolveArtifactDependencies(File artifactFile, Map<String, Object> attributes, ArtifactType artifactType) { if (attributes instanceof PluginExtendedClassLoaderModelAttributes) { BundleDescriptor pluginBundleDescriptor = (BundleDescriptor) attributes.get(BundleDescriptor.class.getName()); ArtifactDescriptor deployableArtifactDescriptor = ((PluginExtendedClassLoaderModelAttributes) attributes).getDeployableArtifactDescriptor(); Set<BundleDependency> deployableArtifactDescriptorDependencies = deployableArtifactDescriptor.getClassLoaderModel().getDependencies(); BundleDependency pluginDependencyInDeployableArtifact = deployableArtifactDescriptorDependencies.stream() .filter(dep -> dep.getDescriptor().equals(pluginBundleDescriptor)).findFirst() .orElseThrow(() -> new MuleRuntimeException(createStaticMessage("Could not find required descriptor. Looking for: " + pluginBundleDescriptor + " in " + deployableArtifactDescriptorDependencies))); if (SYSTEM.equals(pluginDependencyInDeployableArtifact.getScope())) { if (logger.isWarnEnabled()) { logger.warn(format( "Resolving a mule-plugin '%s' with system scope in order to resolve its class loader model. Dependency resolution may fail due to remote repositories from the deployable artifact will not be considered. Prevent this by using compile scope instead", pluginDependencyInDeployableArtifact.getDescriptor())); } return resolveArtifactDependenciesUsingMavenClient(artifactFile); } return collectTransitiveDependencies(pluginDependencyInDeployableArtifact); } return resolveArtifactDependenciesUsingMavenClient(artifactFile); }

Target:
protected Set<BundleDependency> resolveArtifactDependencies(File artifactFile, Map<String, Object> attributes, ArtifactType artifactType) { if (attributes instanceof PluginExtendedClassLoaderModelAttributes) { BundleDescriptor pluginBundleDescriptor = (BundleDescriptor) attributes.get(BundleDescriptor.class.getName()); ArtifactDescriptor deployableArtifactDescriptor = ((PluginExtendedClassLoaderModelAttributes) attributes).getDeployableArtifactDescriptor(); Set<BundleDependency> deployableArtifactDescriptorDependencies = deployableArtifactDescriptor.getClassLoaderModel().getDependencies(); BundleDependency pluginDependencyInDeployableArtifact = deployableArtifactDescriptorDependencies.stream() .filter(dep -> dep.getDescriptor().equals(pluginBundleDescriptor)).findFirst() .orElseThrow(() -> new MuleRuntimeException(createStaticMessage("Could not find required descriptor. Looking for: " + pluginBundleDescriptor + " in " + deployableArtifactDescriptorDependencies))); if (!SYSTEM.equals(pluginDependencyInDeployableArtifact.getScope())) { return collectTransitiveDependencies(pluginDependencyInDeployableArtifact); } else { if (logger.isWarnEnabled()) { logger.warn(format( "Resolving a mule-plugin '%s' with system scope in order to resolve its class loader model. Dependency resolution may fail due to remote repositories from the deployable artifact will not be considered. Prevent this by using compile scope instead", pluginDependencyInDeployableArtifact.getDescriptor())); } } } return resolveArtifactDependenciesUsingMavenClient(artifactFile); }