From 84c56647cfe4347c2a8741f272cd9a70a6b149ff Mon Sep 17 00:00:00 2001 From: Ash Hepburn Date: Fri, 21 Jun 2024 11:09:12 -0400 Subject: [PATCH] update from velocity:1.7 to velocity-engine-core:2.3 --- build.gradle | 11 +++++------ settings.gradle | 2 +- .../com/sumologic/shellbase/VelocityRenderer.scala | 6 +++--- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/build.gradle b/build.gradle index 8bac563..b03f3a4 100644 --- a/build.gradle +++ b/build.gradle @@ -23,7 +23,7 @@ buildscript { ext.scalaSlackClientVersion = '0.4.0' ext.scalatestVersion = '3.0.9' ext.slf4jVersion = '2.0.13' - ext.velocityVersion = '1.7' + ext.velocityVersion = '2.3' } allprojects { @@ -36,13 +36,12 @@ allprojects { group = "com.sumologic.shellbase" description = "Sumo Logic's Scala-based interactive shell framework" - version = '3.0.0' + version = '4.0.0' sourceCompatibility = javaSourceVersion targetCompatibility = javaTargetVersion repositories { - jcenter() mavenCentral() } @@ -162,7 +161,7 @@ project(':shellbase-core') { implementation "commons-cli:commons-cli:${commonsCliVersion}" implementation "commons-io:commons-io:${commonsIoVersion}" implementation "jline:jline:${jlineVersion}" - implementation "org.apache.velocity:velocity:${velocityVersion}" + implementation "org.apache.velocity:velocity-engine-core:${velocityVersion}" implementation "org.scala-lang:scala-library:${scalaMajorVersion}.${scalaMinorVersion}" } } @@ -172,7 +171,7 @@ project(':shellbase-example') { implementation project(':shellbase-core') implementation "jline:jline:${jlineVersion}" implementation "org.scala-lang:scala-library:${scalaMajorVersion}.${scalaMinorVersion}" - implementation "org.apache.velocity:velocity:${velocityVersion}" + implementation "org.apache.velocity:velocity-engine-core:${velocityVersion}" implementation "commons-cli:commons-cli:${commonsCliVersion}" } } @@ -183,7 +182,7 @@ project(':shellbase-slack') { implementation "com.github.slack-scala-client:slack-scala-client_${scalaMajorVersion}:${scalaSlackClientVersion}" implementation "jline:jline:${jlineVersion}" implementation "org.slf4j:slf4j-api:${slf4jVersion}" - implementation "org.apache.velocity:velocity:${velocityVersion}" + implementation "org.apache.velocity:velocity-engine-core:${velocityVersion}" implementation "commons-cli:commons-cli:${commonsCliVersion}" } } diff --git a/settings.gradle b/settings.gradle index 795feac..91e6855 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,4 +1,4 @@ -rootProject.name = 'all' +rootProject.name = 'shellbase' include 'shellbase-core', 'shellbase-example', 'shellbase-slack' determineAndSetScalaVersion() diff --git a/shellbase-core/src/main/scala/com/sumologic/shellbase/VelocityRenderer.scala b/shellbase-core/src/main/scala/com/sumologic/shellbase/VelocityRenderer.scala index 3e0dd2b..bd36a27 100644 --- a/shellbase-core/src/main/scala/com/sumologic/shellbase/VelocityRenderer.scala +++ b/shellbase-core/src/main/scala/com/sumologic/shellbase/VelocityRenderer.scala @@ -20,11 +20,11 @@ package com.sumologic.shellbase import java.io._ import java.util.Properties - import org.apache.commons.io.IOUtils import org.apache.velocity.VelocityContext import org.apache.velocity.app.{Velocity, VelocityEngine} +import java.util import scala.collection.JavaConverters._ object VelocityRenderer { @@ -62,7 +62,7 @@ object VelocityRenderer { } def createScriptFromTemplate(scriptResource: String, - variables: Map[AnyRef, AnyRef] = Map[AnyRef, AnyRef]()): File = { + variables: Map[String, AnyRef] = Map[String, AnyRef]()): File = { val engine = new VelocityEngine() engine.setProperty("resource.loader", "class") engine.setProperty("class.resource.loader.description", "Velocity Classpath Resource Loader") @@ -74,7 +74,7 @@ object VelocityRenderer { val tempFile = File.createTempFile(".tmp", ".sh") - val modifiableVariables = new java.util.HashMap[AnyRef, AnyRef]() + val modifiableVariables: util.HashMap[String, AnyRef] = new java.util.HashMap[String, AnyRef]() modifiableVariables.asScala ++= variables val writer = new FileWriter(tempFile)