/**
* Get all of the non-jdk packages in the current classpath.
*/
public static Set<String> getAllPackages() throws IOException {
FileCollection fileCollection = getClasspathAsFileCollection();
FileCollection jdkFileCollection = JDKFileCollection.getFileCollection();
Set<String> packages = new TreeSet<String>();
for (String filename : fileCollection.getFileNames()) {
if (filename.endsWith(CLASS_SUFFIX)) {
if (!jdkFileCollection.containsFile(filename)) {
filename = filename
.substring(0, filename.length() - CLASS_SUFFIX.length());
String classname = filename.replace(File.separatorChar, '.');
String pkg = getPackage(classname);
packages.add(pkg);