Skip to content

Commit

Permalink
#127 apply the JavaPlugin instead of the JavaConfigurePlugin for appl…
Browse files Browse the repository at this point in the history
…ication modules and also provide the possibility to activate the spring boot plugin also locally

Signed-off-by: Klaus Lehner <[email protected]>
  • Loading branch information
klu2 committed Dec 14, 2022
1 parent 46e8d8d commit dfa992f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import org.springframework.boot.gradle.plugin.SpringBootPlugin

class JavaConfigurePlugin : Plugin<Project> {
override fun apply(project: Project) {
project.plugins.apply(JavaLibraryPlugin::class)
project.plugins.apply(JavaPlugin::class)
project.plugins.apply(JacocoPlugin::class)

if (project.layout.projectDirectory.dir("src/testFixtures").asFile.exists()) {
Expand All @@ -45,6 +45,7 @@ class JavaConfigurePlugin : Plugin<Project> {
applicationBuild.convention(false)
createSourceArtifacts.convention(applicationBuild.map { !it })
applicationFramework.convention(ApplicationFramework.SpringBoot)
applyApplicationFrameworkPluginForDevelopment.convention(false)
}

val javaPluginExtension = extensions.getByType(JavaPluginExtension::class)
Expand All @@ -69,7 +70,9 @@ class JavaConfigurePlugin : Plugin<Project> {
if (javaConfigureExtension.applicationBuild.get()){
when (javaConfigureExtension.applicationFramework.get()) {
ApplicationFramework.SpringBoot -> {
if (BuildUtils.isIntegrationBuild()) {
if (BuildUtils.isIntegrationBuild() ||
javaConfigureExtension.applyApplicationFrameworkPluginForDevelopment.get()
) {
GitExtension.create(project)
SpringBootExtension.create(project)
} else {
Expand All @@ -81,6 +84,8 @@ class JavaConfigurePlugin : Plugin<Project> {
}
else -> {}
}
} else {
project.plugins.apply(JavaLibraryPlugin::class)
}

val compileJava = tasks.named(JavaPlugin.COMPILE_JAVA_TASK_NAME, JavaCompile::class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ abstract class JavaConfigurePluginExtension {
*/
abstract val applicationFramework: Property<ApplicationFramework>

/**
* if this property is set to `false`, then i.e. the Spring Boot plugin will only
* be activated on CI environments
*/
abstract val applyApplicationFrameworkPluginForDevelopment: Property<Boolean>

/**
* The version of JDK that is being used to compile Java and Kotlin code.
* This default is 17.
Expand Down

0 comments on commit dfa992f

Please sign in to comment.