O'Reilly logo

Maven for Eclipse by Sanjay Shah

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Adding dependencies

Our project is a simple web application, and to begin, it will need JUnit as a dependency for testing and log4j for logging purposes. As we progress further, we will add more dependencies progressively; the idea of this section is to show how to add dependencies in the pom file. If we see our pom file, we can see that JUnit is already present as a dependency; so, let's add log4j as a dependency by adding the following code snippet:

<project>
…....
<dependencies>
…
<!-- For logging purpose -->
    <dependency>
      <groupId>log4j</groupId>
      <artifactId>log4j</artifactId>
      <version>1.2.17</version>
    </dependency>
</dependencies>
…....
</project>

The complete resultant pom file would look like the following:

<project xmlns="http://maven.apache.org/POM/4.0.0" ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required