File file = artifact.getFile();
if (processedFiles != null && processedFiles.contains(file.getAbsolutePath())) {
return null;
}
if (!file.exists()) {
throw new GradleException("File '" + file.getAbsolutePath() + "'" +
" does not exists, and need to be published!");
}
if (processedFiles != null) {
processedFiles.add(file.getAbsolutePath());
}
String revision = getProject().getVersion().toString();
Map<String, String> extraTokens = Maps.newHashMap();
if (StringUtils.isNotBlank(artifact.getClassifier())) {
extraTokens.put("classifier", artifact.getClassifier());
}
ArtifactoryClientConfiguration clientConf = getArtifactoryClientConfiguration();
ArtifactoryClientConfiguration.PublisherHandler publisherConf = clientConf.publisher;
String pattern = publisherConf.getIvyArtifactPattern();
String gid = getProject().getGroup().toString();
if (publisherConf.isM2Compatible()) {
gid = gid.replace(".", "/");
}
DeployDetails.Builder deployDetailsBuilder = new DeployDetails.Builder().file(file);
try {
Map<String, String> checksums =
FileChecksumCalculator.calculateChecksums(file, "MD5", "SHA1");
deployDetailsBuilder.md5(checksums.get("MD5")).sha1(checksums.get("SHA1"));
} catch (Exception e) {
throw new GradleException(
"Failed to calculate checksums for artifact: " + file.getAbsolutePath(), e);
}
if (artifactPath != null) {
deployDetailsBuilder.artifactPath(artifactPath);