Training questions answered: Checksums, SSH keys, writing plugins

January 26, 2011 By Matthew McCullough

3 minute read time

You've probably heard that Sonatype teaches a series of online Maven training classes. They are a great way to get you and your team up and running on Maven, and if you have any specific questions we also make sure to leave some space in the class to answer any questions you might have. In my experience, the students that get the most from our classes are the students that ask questions.

In this post, I answer some of the questions that came up in our last training session.

Q: Is there a flag to echo the md5/sha1 checksum during deployment?

Not directly via the deploy plugin flags, but with a separate plugin: http://code.google.com/p/maven-checksum-plugin/. Checksums can be created during install if desired, click here to read the Maven documentation about this method. Checksums can be calculated using typical POSIX tooling (md5sum) and shell scripts as well.

Q: How do I select a SSH Private Key to use for SCP file transfers?

This is answered in the Maven Documentation here. Also, Pascal Thivent, a very active Maven expert on Stackoverflow, has a great answer for this on StackOverflow here. The answer is that you can specify which private SSH key to use in the server element of your Maven settings as follows:

<server>
        <id>myserver</id>
        <username>matthewmccullough</username>
        <privateKey>~/mykeys/id_rsa</privateKey>
        <passphrase>myphrase</passphrase>
</server>

Q: For an Ivy repository, how can an artifact be retrieved from Maven?

If the canonical repository format is Maven, then Ivy is really acting in compatibility mode with Maven and all is well. However, if the repository is in Ivy format (no pom.xml files), the story is a bit more rough: http://markmail.org/message/ohmlv5mk7j7i4smf. My observation is that even when folks are using other build tools like Ivy, Ant, Gradle, Buildr and Leiningen, they typically all agree on the Maven repository format. Most if not all of the build tools recognize and thus have a "Maven repo reading" compatibility.

Note: as the community moves forward on the Aether library, you should see tools start to either converge on best practices when it comes to repository access or get left behind it they decide to interact with repositories in a non-standard way. Tools that interact with Maven repositories should all be using Aether.

Q: Are there any tutorials about writing maven plugins?

Yes, here are two good sources of information:

Tags: Sonatype Says, Sonatype training, Sonatype, Checksum, Maven

Written by Matthew McCullough

Matthew is the Director of Field Services at GitHub. He is a strong proponent of and contributor to open source projects, and has a demonstrated track record of success in applying agile methodologies to software development.