class MvnDependencyListLocalRepositoryResolver implements Resolver {

    @Override
    public Stream<Artifact> resolve(final ClassLoader rootLoader, final String artifact) {
        return Stream
                .of(readDependencies(ofNullable(getJar(artifact))
                        .filter(Files::exists)
                        .map(this::findDependenciesFile)
                        .orElseGet(() -> {
                            final boolean isNested;
                            try (final InputStream stream = rootLoader
                                    .getResourceAsStream(ConfigurableClassLoader.NESTED_MAVEN_REPOSITORY + artifact)) {
                                isNested = stream != null;
                            } catch (final IOException e) {
                                log.debug(e.getMessage(), e);
                                return "";
                            }

                            if (isNested) { // we reuse ConfigurableClassLoader just to not
                                            // rewrite the logic but it is NOT a plugin!
                                try (final ConfigurableClassLoader configurableClassLoader =
                                        new ConfigurableClassLoader("", new URL[0], rootLoader, name -> true,
                                                name -> true, new String[] { artifact }, new String[0])) {
                                    try (final InputStream deps =
                                            configurableClassLoader.getResourceAsStream(dependenciesListFile)) {
                                        return ofNullable(deps).map(s -> {
                                            try {
                                                return slurp(s);
                                            } catch (final IOException e) {
                                                log.debug(e.getMessage(), e);
                                                return "";
                                            }
                                        }).orElse("");
                                    }
                                } catch (final IOException e) {
                                    log.debug(e.getMessage(), e);
                                    return "";
                                }
                            }

                            return "";
                        })));
    }

}