/*
 * Copyright (c) 2012-2017 Red Hat, Inc.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *   Red Hat, Inc. - initial API and implementation
 */
package org.eclipse.che.util;

import java.io.File;
import java.util.stream.Collectors;
import org.reflections.util.ConfigurationBuilder;

/**
 * Reflections configuration builder that ignore resources that is not exists. It happens when ide
 * generators runs on generate-sources stage and ../target/classes folder is listed in class path
 * but not exists. Reflections print NPE for such folders. See more
 * https://github.com/ronmamo/reflections/issues/111
 *
 * @author Sergii Kabashniuk
 */
public final class IgnoreUnExistedResourcesReflectionConfigurationBuilder {

  private static ConfigurationBuilder configurationBuilder;

  static {
    configurationBuilder = ConfigurationBuilder.build();
    configurationBuilder.setUrls(
        configurationBuilder
            .getUrls()
            .stream()
            .filter(
                input -> !"file".equals(input.getProtocol()) || new File(input.getFile()).exists())
            .collect(Collectors.toList()));
  }

  private IgnoreUnExistedResourcesReflectionConfigurationBuilder() {}

  /** @return Reflections ConfigurationBuilder that ignore not existing resources in class path. */
  public static ConfigurationBuilder getConfigurationBuilder() {
    return configurationBuilder;
  }
}

@@ -427,30 +427,153 @@
 ava.
-util.stream.Collectors
+net.URL;%0Aimport java.util.ArrayList;%0Aimport java.util.Collection;%0Aimport java.util.stream.Collectors;%0Aimport org.reflections.util.ClasspathHelper
 ;%0Aim
@@ -1185,16 +1185,227 @@
 uild();%0A
+    Collection%3CURL%3E classpath = new ArrayList%3C%3E();%0A    classpath.addAll(ClasspathHelper.forClassLoader());%0A    classpath.addAll(ClasspathHelper.forJavaClassPath());%0A    configurationBuilder.setUrls(classpath);%0A%0A
     conf

Add missing URLs when using Java9 (it is also working with Java8) It's mainly because system classloader is not anymore a URLClassLoader