Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Fix "SLF4J: Failed to load ..." issue by adding slf4j-simple #935

Merged
merged 2 commits into from
Dec 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .scala-steward.conf
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
pullRequests.frequency = "14 days"

updates.limit = 3

updates.pin = [
{
// jgit 6.x require JDK 11
groupId = "org.eclipse.jgit"
version = "5."
}
},
{ groupId = "org.slf4j", artifactId = "slf4j-simple", version = "1." }
]

updates.ignore = [
Expand Down
10 changes: 7 additions & 3 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,10 @@ lazy val app = (project in file("app"))
csRun / sourceDirectory := {
(baseDirectory).value.getParentFile / "src" / "main" / "conscript"
},
libraryDependencies += launcherIntf
libraryDependencies ++= List(
launcherIntf,
slf4jsimple
)
)

lazy val crossSbt = Seq(
Expand Down Expand Up @@ -157,14 +160,14 @@ lazy val lib = (project in file("library"))
libraryDependencies ++= Seq(
stringTemplate,
jgit,
slf4jsimple,
commonsIo,
plexusArchiver,
scalaXml,
parserCombinator(scalaVersion.value),
scalacheck % Test,
sbtIo % Test,
scalamock % Test,
"org.slf4j" % "slf4j-simple" % "1.7.36" % Test
scalamock % Test
),
Test / testOptions += Tests.Argument(TestFrameworks.ScalaCheck, "-minSuccessfulTests", "1000", "-workers", "10")
)
Expand All @@ -179,6 +182,7 @@ lazy val launcher = (project in file("launcher"))
crossScalaVersions := List(scala212, scala213, scala3),
libraryDependencies ++= Seq(
coursier,
slf4jsimple,
verify % Test,
sbtIo % Test
),
Expand Down
32 changes: 25 additions & 7 deletions launcher/src/test/scala/LauncherTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package testpkg

import giter8._
import verify._
import java.io.File
import java.io.{ByteArrayOutputStream, File, PrintStream}
import sbt.io.IO

object LauncherTest extends BasicTestSuite {
Expand All @@ -22,12 +22,30 @@ object LauncherTest extends BasicTestSuite {
}
}

/*
test("runs git@github.com:scala/scala-seed.g8.git") {
IO.withTemporaryDirectory { dir =>
launcher.run(Array("git@github.com:scala/scala-seed.g8.git", "--name=hello"), dir)
assert((dir / "hello" / "build.sbt").exists)
test("log scala/scala-seed.g8") {
val (r, err) = withErr {
IO.withTemporaryDirectory { dir =>
launcher.run(Array("scala/scala-seed.g8", "--name=hello"), dir)
assert((dir / "hello" / "build.sbt").exists)
}
}
assert(!err.contains("SLF4J"))
}
*/

def withErr[A1](f: => A1): (A1, String) = {
val originalErr = System.err
val byteArrayOutputStream = new ByteArrayOutputStream()
val inMemoryPrintStream = new PrintStream(byteArrayOutputStream)
val result =
try {
System.setErr(inMemoryPrintStream)
val r = f
inMemoryPrintStream.flush()
r
} finally {
System.setErr(originalErr)
}
(result, byteArrayOutputStream.toString)
}

}
1 change: 1 addition & 0 deletions project/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ object Dependencies {
case _ => "2.2.0"
}
}
val slf4jsimple = "org.slf4j" % "slf4j-simple" % "1.7.36"
val logback = "ch.qos.logback" % "logback-classic" % "1.2.3"
val coursier = "io.get-coursier" %% "coursier" % "2.1.13"
val launcherIntf = "org.scala-sbt" % "launcher-interface" % "1.4.4"
Expand Down
Loading