logger.debug("Using "+CLASSPATH_FILTER_SYSTEMAPPS+" '"+filterSystemApps+"'");
logger.debug("Using "+CLASSPATH_FILTER_DESCRIPTORS+" '"+filterDescriptors+"'");
logger.debug("Using "+CLASSPATH_REQUIRE_DESCRIPTOR+" '"+requireDescriptors+"'");
try {
UrlSet urlSet = new UrlSet(classLoader);
UrlSet includes = urlSet.matching(include);
urlSet = urlSet.exclude(ClassLoader.getSystemClassLoader().getParent());
urlSet = urlSet.excludeJavaExtDirs();
urlSet = urlSet.excludeJavaEndorsedDirs();
urlSet = urlSet.excludeJavaHome();
urlSet = urlSet.excludePaths(System.getProperty("sun.boot.class.path", ""));
urlSet = urlSet.exclude(".*/JavaVM.framework/.*");
urlSet = urlSet.exclude(".*/activeio-core-[\\d.]+(-incubator)?.jar(!/)?");
urlSet = urlSet.exclude(".*/activemq-(core|ra)-[\\d.]+.jar(!/)?");
urlSet = urlSet.exclude(".*/annotations-api-6.[01].[\\d.]+.jar(!/)?");
urlSet = urlSet.exclude(".*/avalon-framework-[\\d.]+.jar(!/)?");
urlSet = urlSet.exclude(".*/axis2-jaxws-api-[\\d.]+.jar(!/)?");
urlSet = urlSet.exclude(".*/backport-util-concurrent-[\\d.]+.jar(!/)?");
urlSet = urlSet.exclude(".*/catalina-[\\d.]+.jar(!/)?");
urlSet = urlSet.exclude(".*/commons-(logging|cli|pool|lang|collections|dbcp)-[\\d.]+.jar(!/)?");
urlSet = urlSet.exclude(".*/derby-[\\d.]+.jar(!/)?");
urlSet = urlSet.exclude(".*/geronimo-(connector|transaction)-[\\d.]+.jar(!/)?");
urlSet = urlSet.exclude(".*/geronimo-[^/]+_spec-[\\d.]+.jar(!/)?");
urlSet = urlSet.exclude(".*/geronimo-javamail_([\\d.]+)_mail-[\\d.]+.jar(!/)?");
urlSet = urlSet.exclude(".*/hsqldb-[\\d.]+.jar(!/)?");
urlSet = urlSet.exclude(".*/idb-[\\d.]+.jar(!/)?");
urlSet = urlSet.exclude(".*/idea_rt.jar(!/)?");
urlSet = urlSet.exclude(".*/jaxb-(impl|api)-[\\d.]+.jar(!/)?");
urlSet = urlSet.exclude(".*/jmdns-[\\d.]+(-RC\\d)?.jar(!/)?");
urlSet = urlSet.exclude(".*/juli-[\\d.]+.jar(!/)?");
urlSet = urlSet.exclude(".*/junit-[\\d.]+.jar(!/)?");
urlSet = urlSet.exclude(".*/log4j-[\\d.]+.jar(!/)?");
urlSet = urlSet.exclude(".*/logkit-[\\d.]+.jar(!/)?");
urlSet = urlSet.exclude(".*/openjpa-(jdbc|kernel|lib|persistence|persistence-jdbc)(-5)?-[\\d.]+.jar(!/)?");
urlSet = urlSet.exclude(".*/serp-[\\d.]+.jar(!/)?");
urlSet = urlSet.exclude(".*/servlet-api-[\\d.]+.jar(!/)?");
urlSet = urlSet.exclude(".*/swizzle-stream-[\\d.]+.jar(!/)?");
urlSet = urlSet.exclude(".*/wsdl4j-[\\d.]+.jar(!/)?");
urlSet = urlSet.exclude(".*/xbean-(reflect|naming|finder)-[\\d.]+.jar(!/)?");
urlSet = urlSet.exclude(".*/xmlParserAPIs-[\\d.]+.jar(!/)?");
urlSet = urlSet.exclude(".*/xmlunit-[\\d.]+.jar(!/)?");
UrlSet prefiltered = urlSet;
urlSet = urlSet.exclude(exclude);
urlSet = urlSet.include(includes);
if (filterSystemApps){
urlSet = urlSet.exclude(".*/openejb-[^/]+(.(jar|ear|war)(!/)?|/target/classes/?)");
}
List<URL> urls = urlSet.getUrls();
int size = urls.size();
if (size == 0 && include.length() > 0) {
logger.warning("No classpath URLs matched. Current settings: " + CLASSPATH_EXCLUDE + "='" + exclude + "', " + CLASSPATH_INCLUDE + "='" + include + "'");
return;
} else if (size == 0 && (!filterDescriptors && prefiltered.getUrls().size() == 0)) {
return;
} else if (size < 10) {
logger.debug("Inspecting classpath for applications: " + urls.size() + " urls.");
} else if (size < 50 && !requireDescriptors) {
logger.info("Inspecting classpath for applications: " + urls.size() + " urls. Consider adjusting your exclude/include. Current settings: " + CLASSPATH_EXCLUDE + "='" + exclude + "', " + CLASSPATH_INCLUDE + "='" + include + "'");
} else if (!requireDescriptors) {
logger.warning("Inspecting classpath for applications: " + urls.size() + " urls.");
logger.warning("ADJUST THE EXCLUDE/INCLUDE!!!. Current settings: " + CLASSPATH_EXCLUDE + "='" + exclude + "', " + CLASSPATH_INCLUDE + "='" + include + "'");
}
long begin = System.currentTimeMillis();
processUrls(urls, classLoader, !requireDescriptors, base, jarList);
long end = System.currentTimeMillis();
long time = end - begin;
UrlSet unchecked = new UrlSet();
if (!filterDescriptors){
unchecked = prefiltered.exclude(urlSet);
if (filterSystemApps){
unchecked = unchecked.exclude(".*/openejb-[^/]+(.(jar|ear|war)(./)?|/target/classes/?)");
}
processUrls(unchecked.getUrls(), classLoader, false, base, jarList);
}
if (logger.isDebugEnabled()) {
logger.debug("URLs after filtering: "+urlSet.getUrls().size() + unchecked.getUrls().size());
for (URL url : urlSet.getUrls()) {
logger.debug("Annotations path: " + url);
}
for (URL url : unchecked.getUrls()) {
logger.debug("Descriptors path: " + url);
}
}
if (urls.size() == 0) return;