@SuppressWarnings("deprecation")
  public File downloadSnapshotArtifact(String repository, Gav gav, File parentDir)
      throws IOException {
    // @see http://issues.sonatype.org/browse/NEXUS-599
    // r=<repoId> -- mandatory
    // g=<groupId> -- mandatory
    // a=<artifactId> -- mandatory
    // v=<version> -- mandatory
    // c=<classifier> -- optional
    // p=<packaging> -- optional, jar is taken as default
    // http://localhost:8087/nexus/service/local/artifact/maven/redirect?r=tasks-snapshot-repo&g=nexus&a=artifact&
    // v=1.0-SNAPSHOT
    String serviceURI =
        "service/local/artifact/maven/redirect?r="
            + repository
            + "&g="
            + gav.getGroupId()
            + "&a="
            + gav.getArtifactId()
            + "&v="
            + gav.getVersion();
    Response response = RequestFacade.doGetRequest(serviceURI);
    Status status = response.getStatus();
    if (status.isError()) {
      throw new FileNotFoundException(status + ": (" + status.getCode() + ")");
    }
    Assert.assertEquals(
        "Snapshot download should redirect to a new file\n "
            + response.getRequest().getResourceRef().toString()
            + " \n Error: "
            + status.getDescription(),
        301,
        status.getCode());

    Reference redirectRef = response.getRedirectRef();
    Assert.assertNotNull(
        "Snapshot download should redirect to a new file "
            + response.getRequest().getResourceRef().toString(),
        redirectRef);

    serviceURI = redirectRef.toString();

    File file = FileUtils.createTempFile(gav.getArtifactId(), '.' + gav.getExtension(), parentDir);
    RequestFacade.downloadFile(new URL(serviceURI), file.getAbsolutePath());

    return file;
  }