public static Artifact cloneWithAnotherType(Artifact artifact, String newType) { return cloneWithAnotherTypeAndExt(artifact, newType, artifact.getExt()); }
public static Artifact cloneWithAnotherExt(Artifact artifact, String newExt) { return cloneWithAnotherTypeAndExt(artifact, artifact.getType(), newExt); }
protected void putChecksum(Artifact artifact, File src, String dest, boolean overwrite, String algorithm) throws IOException { File csFile = File.createTempFile("ivytemp", algorithm); try { FileUtil.copy(new ByteArrayInputStream(ChecksumHelper.computeAsString(src, algorithm) .getBytes()), csFile, null); repository.put( DefaultArtifact.cloneWithAnotherTypeAndExt(artifact, algorithm, artifact.getExt() + "." + algorithm), csFile, dest + "." + algorithm, overwrite); } finally { csFile.delete(); } }
protected void putSignature(Artifact artifact, File src, String dest, boolean overwrite) throws IOException { SignatureGenerator gen = getSettings().getSignatureGenerator(signerName); if (gen == null) { throw new IllegalArgumentException("Couldn't sign the artifacts! " + "Unknown signer name: '" + signerName + "'"); } File tempFile = File.createTempFile("ivytemp", gen.getExtension()); try { gen.sign(src, tempFile); repository.put( DefaultArtifact.cloneWithAnotherTypeAndExt(artifact, gen.getExtension(), artifact.getExt() + "." + gen.getExtension()), tempFile, dest + "." + gen.getExtension(), overwrite); } finally { tempFile.delete(); } }