Sometimes we only need a roadmap to start with a new technology that guides us on this journey. The main objective is to not lose our focus with the documentation myriad.
What about 9 steps straight to the point to the understanding of the basic concepts about Maven. Yeah! It’s a high-level overview of good information but short enough not to make you bored.
If you want to go deeper on each topic, take a look at the series of articles we covered previously.
#1 – What is it?
A great way to start is to understand the purpose of a build automation tool. We need to know why using Maven would be a wise choice for our project. Don’t fall into the trap of using new tools because they are beautiful.
#2 – Convention over Configuration
What is the feeling of understanding a configuration at the first time? A convention is very useful to write a project configuration. Any other teammate or even new ones will feel confident to make changes and upgrade the specifications. No more hero developers are needed to handle this.
#3 – Installation
Well, maybe installations are not developers’ preferred tasks. But this time it is for a good cause. It will help you run any Maven command straight from your environment.
This series episode will jumpstart your installations on any platform. I promise it will be quick.
#4 – Creating a Project
Here it can be your brand new project or the migration of your current one. The project configuration will be set in the POM file. Behind it, there is a major default configuration known as Super POM. These major settings will help you to focus on your project needs.
Maven also provides some ways to create a preset model known as archetype. It will jumpstart your basic structure following the convention already defined by the documentation.
#5 – Project Folder Structure
A conventional way to create folders makes all the difference. Maven suggests a specific way to organize the main code, unit tests, resources, scripts, the web content.
After running Maven commands the results are always stored in the target folder. So you feel confident to find the right files not only on your projects but on any Maven project.
#6 – Dealing with dependencies
By the way, this is the best point of using Maven on the path to automation. You can get rid of all that manual control of libraries, easily change the used version and avoid the search for which other dependencies a library needs.
I know that it is a hard task for an existing project depending on its size. But it worth because you only need to do it once. It is the end of classpath troubles after adding a new project dependency.
#7 – Build Lifecycle
Software lifecycle is almost the same for any kind of project. You need to check the files, compile your app, run some unit tests, package your application with the desired format and send it to an artifactory repository manager.
By default, Maven will give commands to reach each phase of the lifecycle. So you can ask a robot to execute all these commands for you in a consistent way.
#8 – Dealing with Plugins
We always have exceptions or unique problems to solve. Think of Maven as a big puzzle that you can change or add behaviors.
So you can change the puzzle piece responsible for building the software to compile with a different JDK version. Or you can add a new piece to control the code quality.
Plugins provide you the freedom to create the best configuration for your scenario.
#9 – Dealing with Repositories
This may go unnoticed during Maven utilization however it is not only from where you get your dependencies but where you can send your software package. The Central Repository will provide most of the dependencies although there are ways to get specific apps. And at the end of your development, you also need to store your stable version to deliver the software to your customer.
This is an extra step exclusive to YOUR project. This article will be updated with all extra requested content based on YOUR needs. Solving and facing real-world problems is the best way to master a technology.
What is your biggest challenge to using Maven on your project?
I would be glad to help you on your journey. Send me an email (firstname.lastname@example.org) or ping me on Twitter @rcmoutinho.