stepandohnal
stepandohnal

Reputation: 457

How to get artifacts SHA1 using mvn command

I am using maven to download jar when deploying. I would like to check the checksum of a deployed jar to prevent redeploy of the same version.

Downloading full jar can be made with this command:

mvn org.apache.maven.plugins:maven-dependency-plugin:2.4:get -DgroupId=com.c.abcd -DartifactId=javaRocket -Dversion=$jar_version -Dpackaging=jar -Dclassifier=shaded -DremoteRepositories=http://repo:8081/nexus/content/groups/public/ -Ddest=C:\\Windows\\temp\\javaRocket.jar -Dtransitive=false

Is it possible to download the SHA1 by similar command or some metadata, where is the SHA1?

Upvotes: 0

Views: 7426

Answers (1)

Aaron Digulla
Aaron Digulla

Reputation: 328564

When deploying, Maven prints the URLs it uses. If it tells you that it deploys http://.../org/some/artifact/1.0/artifact-1.0.jar, then you should be able to get the SHA1 checksum by downloading http://.../org/some/artifact/1.0/artifact-1.0.jar.sha1 with a web browser or a command line tool like wget or curl. I don't know a Maven command or plugin to download only the checksum.

Maven itself ignores the checksum when it comes to double deployment/download; it only uses the release version (i.e. a version without -SNAPSHOT).

Upvotes: 2

Related Questions