def download
      trace "Downloading #{to_spec}"
      remote = Buildr.repositories.remote
      remote = remote.each { |repo| repo[:url].path += '/' unless repo[:url].path[-1] == '/' }
      fail "Unable to download #{to_spec}. No remote repositories defined." if remote.empty?
      exact_success = remote.find do |repo|        
        begin
          path = "#{group_path}/#{id}/#{version}/#{File.basename(name)}"          
          download_artifact(repo[:url] + path, repo)
          true
        rescue URI::NotFoundError
          false
        rescue Exception=>error
          info error
          trace error.backtrace.join("\n")
          false
        end
      end

      if exact_success
        return
      elsif snapshot?
        download_m2_snapshot(remote)
      else
        fail_download(remote)
      end
    end
def download
      trace "Downloading #{to_spec}"
      remote = Buildr.repositories.remote
      remote = remote.each { |repo| repo[:url].path += '/' unless repo[:url].path[-1] == '/' }
      fail "Unable to download #{to_spec}. No remote repositories defined." if remote.empty?
      exact_success = remote.find do |repo|        
        begin
          path = "#{group_path}/#{id}/#{version}/#{File.basename(name)}"          
          download_artifact(repo[:url] + path, repo)
          true
        rescue URI::NotFoundError
          false
        rescue Exception=>error
          info error
          trace error.backtrace.join("\n")
          false
        end
      end

      if exact_success
        return
      elsif snapshot?
        download_m2_snapshot(remote)
      else
        fail_download(remote)
      end
    end
:call-seq:
   download

 Downloads an artifact from one of the remote repositories, and stores it in the local
 repository. Raises an exception if the artifact is not found.

 This method attempts to download the artifact from each repository in the order in
 which they are returned from #remote, until successful.