Access classpath lazily to allow later changes to be picked up
Previously, the classpath of bootJar, bootWar, and bootRun was configured directly as a FileCollection derived from the main source set's runtime classpath. This direct configuration meant that subsequent changes to the main source set's runtime classpath may not have been picked up. This commit changes the configuration of the classpath to use a Callable. This indirection allows subsequent changes to the main source set's runtime classpath to be picked up as long as they occur before Gradle calls the callable. Closes gh-29672pull/29762/head
parent
52f1799c20
commit
43ca2d2cb0
@ -0,0 +1,15 @@
|
|||||||
|
plugins {
|
||||||
|
id 'java'
|
||||||
|
id 'org.springframework.boot' version '{version}'
|
||||||
|
}
|
||||||
|
|
||||||
|
sourceSets {
|
||||||
|
secondary
|
||||||
|
main {
|
||||||
|
runtimeClasspath += secondary.output
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bootJar {
|
||||||
|
mainClass = 'com.example.Application'
|
||||||
|
}
|
@ -0,0 +1,15 @@
|
|||||||
|
plugins {
|
||||||
|
id 'war'
|
||||||
|
id 'org.springframework.boot' version '{version}'
|
||||||
|
}
|
||||||
|
|
||||||
|
sourceSets {
|
||||||
|
secondary
|
||||||
|
main {
|
||||||
|
runtimeClasspath += secondary.output
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bootWar {
|
||||||
|
mainClass = 'com.example.Application'
|
||||||
|
}
|
@ -0,0 +1,15 @@
|
|||||||
|
plugins {
|
||||||
|
id 'java'
|
||||||
|
id 'org.springframework.boot' version '{version}'
|
||||||
|
}
|
||||||
|
|
||||||
|
sourceSets {
|
||||||
|
secondary
|
||||||
|
main {
|
||||||
|
runtimeClasspath += secondary.output
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
springBoot {
|
||||||
|
mainClass = 'com.example.bootrun.main.CustomMainClass'
|
||||||
|
}
|
Loading…
Reference in New Issue