diff --git a/libs/gretty-runner/src/main/groovy/org/akhikhl/gretty/Runner.groovy b/libs/gretty-runner/src/main/groovy/org/akhikhl/gretty/Runner.groovy index e574a224..b5607cdb 100644 --- a/libs/gretty-runner/src/main/groovy/org/akhikhl/gretty/Runner.groovy +++ b/libs/gretty-runner/src/main/groovy/org/akhikhl/gretty/Runner.groovy @@ -101,9 +101,15 @@ final class Runner { } } else if (data.startsWith('redeploy ')) { - List webappList = data.replace('redeploy ', '').split(' ').toList() - serverManager.redeploy(webappList) - writer.writeMayFail('redeployed') + ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader() + Thread.currentThread().setContextClassLoader(cl) + try { + List webappList = data.replace('redeploy ', '').split(' ').toList() + serverManager.redeploy(webappList) + writer.writeMayFail('redeployed') + } finally { + Thread.currentThread().setContextClassLoader(oldClassLoader) + } } } } finally {