Skip to content

Gradle example in reference docs does not work due to missing apply of the dependency management plugin #14878

Closed
@xenoterracide

Description

@xenoterracide

From the reference docs

The following example shows a typical build.gradle file:

plugins {
	id 'org.springframework.boot' version '2.0.6.RELEASE'
	id 'java'
}


jar {
	baseName = 'myproject'
	version =  '0.0.1-SNAPSHOT'
}

repositories {
	jcenter()
}

dependencies {
	compile("org.springframework.boot:spring-boot-starter-web")
	testCompile("org.springframework.boot:spring-boot-starter-test")
}

however, this will fail to resolve dependencies because it doesn't apply the dep management plugin (this will fail unless you uncomment the plugin) here's an example in kotlin dsl.

plugins {
    `java-library`
    id("org.springframework.boot").version("2.0.6.RELEASE")
//    id("io.spring.dependency-management").version("1.0.6.RELEASE")
}

group = "com.xenoterracide.example"
version = "1.0-SNAPSHOT"

repositories {
    mavenCentral()
}

dependencies {
    implementation("org.springframework.boot:spring-boot-starter-web")
    runtime("org.springframework.boot:spring-boot-starter-actuator")
    testImplementation("org.springframework.boot:spring-boot-starter-test")
    testImplementation("org.junit.jupiter:junit-jupiter-api")
    testRuntimeOnly( "org.junit.jupiter:junit-jupiter-engine")
}

configure<JavaPluginConvention> {
    sourceCompatibility = JavaVersion.VERSION_1_8
}

tasks.withType<Test>().configureEach {
    useJUnitPlatform()
}

p.s. it'd be nice of the gradle docs used cross language groovy/kotlin syntax where possible.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions