code: public void copyResources( URI uri, ClassLoader classLoader, File target )
              throws MojoExecutionException
      {
          URL url;
  
          String scheme = uri.getScheme();
          if ( "classpath".equals( scheme ) )
          {
  
              // get resource from class-path
              String path = uri.getPath();
  
              if ( path == null )
              {
                  // can happen when using classpath:myFile
                  path = uri.toString().substring( scheme.length() + 1 );
              }
  
              if ( path.startsWith( "/" ) )
              {
                  // remove first car
                  path = path.substring( 1 );
              }
              url = classLoader.getResource( path );
          }
          else
          {
              // classic url from uri
              try
              {
                  url = uri.toURL();
              }
              catch ( MalformedURLException e )
              {
                  throw new MojoExecutionException( "Bad uri syntax " + uri, e );
              }
          }
  
          InputStream inputStream;
  
          try
          {
              inputStream = url.openStream();
          }
          catch ( IOException e )
          {
              throw new MojoExecutionException( "Could not open resource " + url, e );
          }
  
          if ( inputStream == null )
          {
              throw new MojoExecutionException( "Could not find resource " + url );
          }
          try
          {
              OutputStream outputStream = null;
  
              try
              {
                  outputStream = new FileOutputStream( target );
                  org.codehaus.plexus.util.IOUtil.copy( inputStream, outputStream );
                  outputStream.close();
                  inputStream.close();
              }
              catch ( IOException e )
              {
                  throw new MojoExecutionException( "Could not copy resource from " + url + " to " + target, e );
              }
              finally
              {
                  if ( outputStream != null )
                  {
                      org.codehaus.plexus.util.IOUtil.close( outputStream );
                  }
              }
          }
  
          finally
          {
              org.codehaus.plexus.util.IOUtil.close( inputStream );
          }
  
      }
docs: {@inheritDoc}