Source:
protected ClassLoaderModel createHeavyPackageClassLoaderModel(File artifactFile, File classLoaderModelDescriptor, Map<String, Object> attributes, Optional<File> deployableArtifactRepositoryFolder) { org.mule.tools.api.classloader.model.ClassLoaderModel packagerClassLoaderModel = getPackagerClassLoaderModel(classLoaderModelDescriptor); final ArtifactClassLoaderModelBuilder classLoaderModelBuilder = newHeavyWeightClassLoaderModelBuilder(artifactFile, (BundleDescriptor) attributes.get(BundleDescriptor.class.getName()), packagerClassLoaderModel, attributes); final HashSet<String> exportedPackages = new HashSet<>(getAttribute(attributes, EXPORTED_PACKAGES)); final HashSet<String> exportedResources = new HashSet<>(getAttribute(attributes, EXPORTED_RESOURCES)); classLoaderModelBuilder .exportingPackages(exportedPackages) .exportingResources(exportedResources) .exportingPrivilegedPackages(new HashSet<>(getAttribute(attributes, PRIVILEGED_EXPORTED_PACKAGES)), new HashSet<>(getAttribute(attributes, PRIVILEGED_ARTIFACTS_IDS))); Set<BundleDependency> bundleDependencies; if (deployableArtifactRepositoryFolder.isPresent()) { Set<BundleDependency> patchBundleDependencies = getPatchedBundledDependencies(artifactFile, deployableArtifactRepositoryFolder.get()); bundleDependencies = packagerClassLoaderModel.getDependencies().stream().map(artifact -> { Optional<BundleDependency> patchedBundledDependency = patchBundleDependencies.stream().filter(bundleDependency -> bundleDependency.getDescriptor().getGroupId() .equals(artifact.getArtifactCoordinates().getGroupId()) && bundleDependency.getDescriptor().getArtifactId().equals(artifact.getArtifactCoordinates().getArtifactId())) .findAny(); return patchedBundledDependency .orElse(createBundleDependencyFromPackagerDependency(getDeployableArtifactRepositoryUriResolver(deployableArtifactRepositoryFolder .get())).apply(artifact)); }).collect(toSet()); } else { bundleDependencies = packagerClassLoaderModel.getDependencies().stream() .map(artifact -> createBundleDependencyFromPackagerDependency(uri -> uri).apply(artifact)) .collect(toSet()); } populateLocalPackages(artifactFile, classLoaderModelBuilder, bundleDependencies, exportedPackages, exportedResources); classLoaderModelBuilder.dependingOn(bundleDependencies); return classLoaderModelBuilder.build(); }

Target:
protected ClassLoaderModel createHeavyPackageClassLoaderModel(File artifactFile, File classLoaderModelDescriptor, Map<String, Object> attributes, Optional<File> deployableArtifactRepositoryFolder) { org.mule.tools.api.classloader.model.ClassLoaderModel packagerClassLoaderModel = getPackagerClassLoaderModel(classLoaderModelDescriptor); final ArtifactClassLoaderModelBuilder classLoaderModelBuilder = newHeavyWeightClassLoaderModelBuilder(artifactFile, (BundleDescriptor) attributes.get(BundleDescriptor.class.getName()), packagerClassLoaderModel, attributes); final Set<String> exportedPackages = new HashSet<>(getAttribute(attributes, EXPORTED_PACKAGES)); final Set<String> exportedResources = new HashSet<>(getAttribute(attributes, EXPORTED_RESOURCES)); classLoaderModelBuilder .exportingPackages(exportedPackages) .exportingResources(exportedResources) .exportingPrivilegedPackages(new HashSet<>(getAttribute(attributes, PRIVILEGED_EXPORTED_PACKAGES)), new HashSet<>(getAttribute(attributes, PRIVILEGED_ARTIFACTS_IDS))); Set<BundleDependency> bundleDependencies; if (deployableArtifactRepositoryFolder.isPresent()) { Set<BundleDependency> patchBundleDependencies = getPatchedBundledDependencies(artifactFile, deployableArtifactRepositoryFolder.get()); bundleDependencies = packagerClassLoaderModel.getDependencies().stream().map(artifact -> { Optional<BundleDependency> patchedBundledDependency = patchBundleDependencies.stream().filter(bundleDependency -> bundleDependency.getDescriptor().getGroupId() .equals(artifact.getArtifactCoordinates().getGroupId()) && bundleDependency.getDescriptor().getArtifactId().equals(artifact.getArtifactCoordinates().getArtifactId())) .findAny(); return patchedBundledDependency .orElse(createBundleDependencyFromPackagerDependency(getDeployableArtifactRepositoryUriResolver(deployableArtifactRepositoryFolder .get())).apply(artifact)); }).collect(toSet()); } else { bundleDependencies = packagerClassLoaderModel.getDependencies().stream() .map(artifact -> createBundleDependencyFromPackagerDependency(uri -> uri).apply(artifact)) .collect(toSet()); } final List<URL> dependenciesArtifactsUrls = loadUrls(artifactFile, classLoaderModelBuilder, bundleDependencies); populateLocalPackages(artifactFile, classLoaderModelBuilder, dependenciesArtifactsUrls, exportedPackages, exportedResources); classLoaderModelBuilder.dependingOn(bundleDependencies); return classLoaderModelBuilder.build(); }