1717package com.netflix.gradle.plugins.application
1818
1919import com.netflix.gradle.plugins.BaseIntegrationTestKitSpec
20- import com.netflix.gradle.plugins.SupportedGradleVersions
2120import com.netflix.gradle.plugins.deb.Scanner
2221import org.junit.Rule
2322import org.junit.contrib.java.lang.system.ProvideSystemProperty
@@ -91,14 +90,13 @@ class OspackageApplicationSpringBootPluginLauncherSpec extends BaseIntegrationTe
9190 }
9291
9392 @Unroll
94- def ' application shows up in deb for boot #bootVersion and gradle #testGradleVersion ' () {
93+ def ' application shows up in deb for boot #bootVersion' () {
9594 final applicationDir = " $moduleName -boot"
9695 final startScript = " ./opt/${ applicationDir} /bin/${ moduleName} "
9796 buildFile << buildScript(bootVersion, null )
9897
9998 when :
10099 forwardOutput = true
101- gradleVersion = testGradleVersion
102100 runTasks(' build' , ' buildDeb' , " --stacktrace" )
103101
104102 then :
@@ -115,17 +113,15 @@ class OspackageApplicationSpringBootPluginLauncherSpec extends BaseIntegrationTe
115113 assert scanner. getEntry(" ${ it} " ). isFile()
116114 }
117115
118- // make sure we don't have boot jar in debian
116+ // make sure we don't have boot jar in debian
119117 def jarFile = new JarFile (scanner. getEntryFile(moduleJarName))
120118 ! isBootJar(jarFile)
121119
122120 ! scanner. controlContents. containsKey(' ./postinst' )
123121
124122 where :
125- bootVersion | testGradleVersion | moduleSuffix
126- ' 3.5.2' | SupportedGradleVersions . GRADLE_MAX | ' -plain'
127- ' 3.5.2' | SupportedGradleVersions . GRADLE_MIN | ' -plain'
128- ' 2.7.18' | SupportedGradleVersions . GRADLE_MIN | ' -plain'
123+ bootVersion | moduleSuffix
124+ ' 3.5.2' | ' -plain'
129125 }
130126
131127 private boolean isBootJar (JarFile jarFile ) {
@@ -232,4 +228,32 @@ class OspackageApplicationSpringBootPluginLauncherSpec extends BaseIntegrationTe
232228 where :
233229 bootVersion << [' 3.5.2' ]
234230 }
231+
232+ @Unroll
233+ def ' developmentOnly dependencies are not present in distribution for #bootVersion' () {
234+ def installDir = new File (projectDir, " build/install/$moduleName -boot" )
235+ final startScript = file(" $installDir /bin/$moduleName " )
236+
237+ buildFile << buildScript(bootVersion, startScript)
238+ buildFile << """
239+
240+ dependencies {
241+ developmentOnly "org.springframework.boot:spring-boot-devtools:$bootVersion "
242+ }
243+ """
244+
245+ when :
246+ runTasks(' installDist' )
247+
248+ then :
249+ ! startScript. text. contains(' spring-boot-devtools-4.0.3.jar' )
250+
251+ def libDir = new File (installDir, ' lib' )
252+ ! new File (libDir, ' spring-boot-devtools-4.0.3.jar' ). exists()
253+ libDir. listFiles(). size() == 21
254+
255+ where :
256+ bootVersion << [' 3.5.2' ]
257+ }
258+
235259}
0 commit comments