Sobes.tech
Junior — Middle

What scope do you use for including JUnit in the pom.xml file when working with Maven?

sobes.tech AI

Answer from AI

When connecting JUnit in Maven, the scope test is usually used in the pom.xml file. This means that the dependency is only available during compilation and test execution, but is not included in the final artifact.

Example of connecting JUnit 5:

<dependency>
    <groupId>org.junit.jupiter</groupId>
    <artifactId>junit-jupiter</artifactId>
    <version>5.9.2</version>
    <scope>test</scope>
</dependency>

Using the scope test allows you to separate dependencies needed only for testing from the main application dependencies.

What scope do you use for including JUnit in the… - sobes.tech