'Access dependencies in Gradle build script from project

I have the Gradle build script

plugins {
    id 'org.springframework.boot' version '2.6.3'
    id 'io.spring.dependency-management' version '1.0.11.RELEASE'
    id 'java'
}

group = 'com.example'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '11'

repositories {
    mavenCentral()
}

dependencies {
    implementation 'org.springframework.boot:spring-boot-starter-web'
    testImplementation 'org.springframework.boot:spring-boot-starter-test'
}

tasks.named('test') {
    useJUnitPlatform()
}

How can i access over the Project Object all dependencies which are declared in the build script? In the gradle API documentation I read that I could use

Project.getDependencies()

but i not really understand how to access over that all dependencies, I can only add some. I'm really new with Gradle. Hope someone can help.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source