Maven Tutorial: Nice and Easy [Video]
Want a fun and engaging intro to the Maven build ecosystem? Check out this live-coding session on a new episode of "Marco Codes."
Join the DZone community and get the full member experience.
Join For FreeEver looked for a comprehensive intro to Maven that is fun and entertaining at the same time? Then have a look at this brand-new episode of the "Marco Codes" YouTube channel: Maven Tutorial - Nice & Easy.
In this video, you'll learn how to use Maven like a professional: installations, using the mvn
wrapper, using Maven together with IDEs, and of course the Maven basics. From pom.xml
concepts to running commands (clean install
) to understanding Maven repositories and multi-module projects, by the end of it, there won't be many questions left when it comes to Maven.
What’s in the Video?
Every new Maven project starts with the question: Where do I get Maven from in the first place? Hence, we're going to have a look at several options, from manual installations to OS-specific package managers.
Interestingly, Maven nowadays also comes with a so-called Maven wrapper, so you don't need to have it installed to build your projects. Instead, you have a tiny Maven installation living right next to your project files that runs on every operating system. We're going to take a look at how to install and use the wrapper and the differences to a global Maven installation.
Usually, you end up using Maven together with IDEs, like IntelliJ IDEA. We're going to spend some time opening up and importing projects into IntelliJ and highlight a couple of important caveats. Who hasn't added dependencies to their pom.xml file, but IntelliJ somehow didn't start downloading them?
Then follows a deep dive into Maven's pom.xml
file: the basis for every Maven project. From the <build>
section, to <dependencies>
to <scopes>
and <properties>
, we'll look at the most important concepts you need in your day-to-day work-life.
What would a Maven project be without dependencies? We're going to take a look at Maven's dependencies from a practical perspective. How would you go about finding the right dependencies for your project? Where? Which platforms are there? Can you do all of that directly from inside your IDE? What are the caveats?
Having a valid pom.xml
and dependencies are the basis for running Maven commands. Hence, we're going to take a look at the most popular Maven commands, starting with clean
, compile
, test
, package
, and then finally, install
. You'll learn what the differences between these commands are and why it's not necessary to always run mvn clean install
, like so many people do.
An often overlooked part of Maven is properly understanding Maven repositories. What's the local Maven repository? What are remote Maven repositories? Which are the most popular Maven repos and which one should you use? You'll find out during the video tutorial.
Last but not least, we'll need to spice it up a little. Real-world projects often don't just exist of one Maven module. More specifically, they're almost always multi-module projects, with parent-child or sibling relationships. You'll learn how to create multi-module projects, what to watch out for and that they're usually not much harder to handle than single-module projects.
If you managed to watch the entire video, you'll be presented with some hints, tips, and resources, that will help you continue your Maven learning journey on your own. Check it out and let us know what you think!
Published at DZone with permission of Marco Behler. See the original article here.
Opinions expressed by DZone contributors are their own.
Comments