7.3. Updating the POM

You can also add/update project dependencies. In the past, you may have done this by manually including a JAR file on your classpath. With Maven, we can add the dependency in the POM and Maven will download the necessary JAR file and add it to the classpath for us! For example, the pom.xml file in your cs1302-mvn project already contains the following dependencies:

<dependencies>
  <dependency>
    <groupId>org.junit.jupiter</groupId>
    <artifactId>junit-jupiter-api</artifactId>
    <scope>test</scope>
  </dependency>
  <dependency>
    <groupId>org.junit.jupiter</groupId>
    <artifactId>junit-jupiter-params</artifactId>
    <scope>test</scope>
  </dependency>
</dependencies>

These lines configure the project to use the JUnit 5 library for unit testing. To add more dependencies, you would simply add an additional <dependency></dependency> tag with appropriate values before the closing </dependencies> tag. Many libraries are packages for Maven. You can try searching for some on Maven Central.

When using Maven with your JavaFX projects, you will need to add the JavaFX 17 dependency to your pom.xml file. Adding this dependency to the existing junit dependency would look like this:

<dependencies>
  <dependency>
    <groupId>org.junit.jupiter</groupId>
    <artifactId>junit-jupiter-api</artifactId>
    <scope>test</scope>
  </dependency>
  <dependency>
    <groupId>org.junit.jupiter</groupId>
    <artifactId>junit-jupiter-params</artifactId>
    <scope>test</scope>
  </dependency>
  <dependency>
    <groupId>org.openjfx</groupId>
    <artifactId>javafx-controls</artifactId>
    <version>17.0.17</version>
  </dependency>
</dependencies>