Skip to content

Commit

Permalink
Merge pull request #394 from nebula-plugins/dannyt/spring-extension-m…
Browse files Browse the repository at this point in the history
…ainclass

Previous users of this plugin might have used the springBoot extension
  • Loading branch information
DanielThomas authored Feb 11, 2021
2 parents 0d38d23 + 0ca50ef commit 9f9cbe0
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ class OspackageApplicationSpringBootPlugin implements Plugin<Project> {
}
}
}
// Allow the springBoot extension configuration to propagate to the application plugin
if (!project.application.mainClass.isPresent()) {
project.application.mainClass.set(project.springBoot.mainClassName)
}
}
} else {
project.tasks.getByName(DistributionPlugin.TASK_INSTALL_NAME).dependsOn('bootRepackage')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,31 @@ class OspackageApplicationSpringBootPluginLauncherSpec extends IntegrationSpec {
'2.4.2' | _
}

@Unroll
def 'application runs for boot #bootVersion when mainClassName configured using springBoot extension'() {
final applicationDir = "$moduleName-boot"
final startScript = file("build/install/$applicationDir/bin/$moduleName")

buildFile << buildScript(bootVersion, startScript)
buildFile << """
mainClassName = null
springBoot {
mainClassName = 'nebula.test.HelloWorld'
}
"""

when:
def result = runTasksSuccessfully('runStartScript')

then:
result.standardOutput.contains('Hello Integration Test')

where:
bootVersion | _
'2.4.2' | _
}

@Unroll
def 'can customize destination for boot #bootVersion'() {
buildFile << buildScript(bootVersion, null)
Expand Down

0 comments on commit 9f9cbe0

Please # to comment.