From 57abbcd7a3fb2786f31f67033c3f69fe1dcaf91a Mon Sep 17 00:00:00 2001 From: John Blum Date: Wed, 22 Jun 2022 12:29:09 -0700 Subject: [PATCH] Simplify logic in SpringSampleWarPlugin. --- .../io/spring/gradle/convention/SpringSampleWarPlugin.groovy | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/buildSrc/src/main/groovy/io/spring/gradle/convention/SpringSampleWarPlugin.groovy b/buildSrc/src/main/groovy/io/spring/gradle/convention/SpringSampleWarPlugin.groovy index eea9483..829f4b4 100644 --- a/buildSrc/src/main/groovy/io/spring/gradle/convention/SpringSampleWarPlugin.groovy +++ b/buildSrc/src/main/groovy/io/spring/gradle/convention/SpringSampleWarPlugin.groovy @@ -116,9 +116,6 @@ class SpringSampleWarPlugin extends SpringSamplePlugin { } def static getRandomPort() { - ServerSocket serverSocket = new ServerSocket(0) - int port = serverSocket.localPort - serverSocket.close() - return port + new ServerSocket(0).withCloseable { it.localPort } } }