What is Apache Maven? Build and dependency management for Java

Get started with Maven, the most popular build and dependency management tool for Java.

1 2 Page 2
Page 2 of 2

As you develop or maintain software, you will need to add new features to an existing project from time to time. Fortunately, Maven makes adding new features very easy. Let's say you're working on the project defined in Listing 1, and realize you need some utilities from the Apache Commons Language library. You can easily insert that dependency right into the original POM file after JUnit, as shown in Listing 3.

Listing 3. Adding a dependency


<dependency>
    <groupId>org.apache.commons</groupId>
    <artifactId>commons-lang3</artifactId>
    <version>3.0</version>
</dependency>

Finding dependencies is also easy; for this one, you could just type "maven stringutils" into a web browser, and it would turn up. Or you could search the Central Maven Repository directly. You might also find a link to a dependency you need when you're reading about it on a project homepage or other resource. Just cut and paste the URL and be sure to note the correct version number, and you're good to go.

[ Do more with Maven: Learn how Maven works hand-in-hand with Jenkins, JUnit, and Docker for a classic and capable CI/CD framework. ]

Conclusion

Maven is so commonly used because it works well and is mature enough to handle virtually anything you throw at it. Understanding Maven and using it as a base for your projects unlocks the vast amount of capability available to you in the Java ecosystem. To get just a taste of what's possible, consider checking out any of these projects, which are all accessible via the Maven core plugins.

This story, "What is Apache Maven? Build and dependency management for Java" was originally published by JavaWorld.

Copyright © 2020 IDG Communications, Inc.

1 2 Page 2
Page 2 of 2