Dependency scopes
On This Lesson 4 topics
The content for this lesson is written and waiting for review. The outline below shows what it covers. It will be published once it is approved.
In this lesson
choose the right scope for each dependency.
Planned topics
- A scope says when a dependency is needed: compile, test, or run.
compile(default): needed to build and run. Example: a library you call in your code.provided: needed to build, but the server supplies it at run time.runtime: not needed to compile, only to run. Example: a database driver.test: only for tests. Example: JUnit. Never usecompilefor test libraries.
Draft outline details
Demonstration
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>Check your understanding
Which scope for a JDBC driver you never call directly?
Show answer
runtime.
Practice
Apply this lesson with the module's lab, exercises and quiz.
Marking a lesson complete is optional and you can undo it any time. Your progress stays in this browser.