Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#127 apply the JavaPlugin instead of the JavaConfigurePlugin #137

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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