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.
Over the course of the last several months of teaching the Maven 101 and 201 courses with Sonatype, it has been exciting to hear some of the “aha” moments that students have had. I’d like to discuss some of the most frequently occurring ones in a series of blog posts, starting with the most common epiphany:
- Dependency management doesn’t select the highest version
A misconception that I’ve often heard is that “Maven chooses the highest version” when two or more transitive dependencies disagree on the version of a given groupId and ArtifactId coordinate.
It may surprise you to learn that Maven’s dependency resolution process is a rather simple one. This simplicity is actually a benefit for the sake of debugging and manually resolving the dependencies.
The fact is that Maven resolves the version nearest to the top of the dependency tree. But how can you visualize this hierarchy? There are two approaches.
The first approach is via the command line and the dependency plugin. At the prompt in a Maven project, type:
Sonatype uses the Amazon Web Services Elastic Compute Cloud, better known as EC2, for all our training lab machines. Most of our students use a training workstation for 3-4 hours per class, and since we often have bursts of custom training activity it just wouldn’t make sense for us to own real, physical hardware to support training. If we were maintaining our own hardware, we would have to either maintain enough capacity to teach several classes simultaneously, or we would have to limit the number of classes we deliver. For Sonatype’s training effort, instantiating machines as they are needed is the right thing to do and is exactly what the cloud is designed for.
Sonatype has leveraged AWS’s great set of command line APIs and written scripts on top of them. We just invoke “instantiate-lab-machines-small.sh 10″ and poof, we have a set of pristine machines for the students, all running VNC as a service (for remote desktop access) and pre-setup with the latest version of Maven, Eclipse, and the m2eclipse plugin. No teardown. No hardware maintenance. No hassle. We even have a subsequent script that lists out the machines hostnames for each copy-and-paste into the email that goes out to the students.
While our overhead for training infrastructure is smaller than it has ever been, our use of AWS is about much more than just the reduction in cost associated with cloud-based hardware, we’re much more agile because it takes us 10 minutes to create infrastructure. I don’t even want to imagine owning these lab machines. As our training offerings expand, we’ll be using more and more of these lab machines. I can foresee a day when we’ll literally have a set of AWS machines up around the clock to serve our training offerings. Until then, it’s pay by the hour — the raison d’etre for cloud based offerings.
Click here for more information about Sonatype Training.