code: public static String getClassPathElement(final URL anURL, final String encoding) throws IllegalArgumentException {
  
          // Check sanity
          Validate.notNull(anURL, "anURL");
  
          final String protocol = anURL.getProtocol();
          String toReturn = null;
  
          if (FILE.supports(protocol)) {
  
              final String originalPath = anURL.getPath();
              try {
                  return URLDecoder.decode(anURL.getPath(), encoding);
              } catch (UnsupportedEncodingException e) {
                  throw new IllegalArgumentException("Could not URLDecode path [" + originalPath
                          + "] using encoding [" + encoding + "]", e);
              }
          } else if (JAR.supports(protocol)) {
              toReturn = anURL.getPath();
          } else if (HTTP.supports(protocol) || HTTPS.supports(protocol)) {
              toReturn = anURL.toString();
          } else if (BUNDLERESOURCE.supports(protocol)) { // e.g. when used in Eclipse/m2e
              toReturn = anURL.toString();
          } else {
              throw new IllegalArgumentException("Unknown protocol [" + protocol + "]; could not handle URL ["
                      + anURL + "]");
          }
  
          return toReturn;
      }
docs: Converts the supplied URL to a class path element.
  
  @param anURL    The non-null URL for which to acquire a classPath element.
  @param encoding The encoding used by Maven.
  @return The full (i.e. non-chopped) classpath element corresponding to the supplied URL.
  @throws java.lang.IllegalArgumentException if the supplied URL had an unknown protocol.