From b77402537b9a0d4c5c70d0253cc6f9085b38b406 Mon Sep 17 00:00:00 2001 From: eikek Date: Sun, 22 Jan 2023 21:46:16 +0100 Subject: [PATCH] Fix bad defined dependency Must not be `compile->test` as this pulls in test dependencies of the other project. Also improves on `withTestSettingsDependsOn` and removes junit dependency from stanfordnlp-core. Issue: #1856 --- build.sbt | 2 +- project/Dependencies.scala | 1 + project/TestSettings.scala | 10 ++++------ 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/build.sbt b/build.sbt index 5d6ff0f7..376a76ff 100644 --- a/build.sbt +++ b/build.sbt @@ -662,7 +662,7 @@ val ftspsql = project Dependencies.postgres ++ Dependencies.flyway ) - .dependsOn(common, ftsclient, store % "compile->test;test->test") + .dependsOn(common, ftsclient, store % "compile->compile;test->test") val restapi = project .in(file("modules/restapi")) diff --git a/project/Dependencies.scala b/project/Dependencies.scala index b3214284..98b805ac 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -198,6 +198,7 @@ object Dependencies { ExclusionRule("com.sun.xml.bind", "jaxb-core"), ExclusionRule("javax.xml.bind", "jaxb-api"), ExclusionRule("javax.activation"), + ExclusionRule("junit", "junit"), ExclusionRule("de.jollyday", "jollyday"), ExclusionRule("com.apple", "AppleJavaExtensions"), ExclusionRule("org.glassfish", "javax.json") diff --git a/project/TestSettings.scala b/project/TestSettings.scala index 67073f6f..fbbd958c 100644 --- a/project/TestSettings.scala +++ b/project/TestSettings.scala @@ -10,13 +10,11 @@ object TestSettingsPlugin extends AutoPlugin { ds.fold(d0)(_ ++ _).map(_ % Test) implicit class ProjectTestSettingsSyntax(project: Project) { - def withTestSettings = + def withTestSettings: Project = project.settings(testSettings) - def withTestSettingsDependsOn(p: Project, ps: Project*) = - (p :: ps.toList).foldLeft(project) { (cur, dep) => - cur.dependsOn(dep % "test->test,compile") - } + def withTestSettingsDependsOn(p: Project, ps: Project*): Project = + withTestSettings.dependsOn((p +: ps).map(_ % "test->test"): _*) } implicit class CrossprojectTestSettingsSyntax(project: CrossProject) { @@ -29,7 +27,7 @@ object TestSettingsPlugin extends AutoPlugin { import autoImport._ val testSettings = Seq( - libraryDependencies ++= inTest(Dependencies.munit, Dependencies.scribe), + libraryDependencies ++= (Dependencies.munit ++ Dependencies.scribe).map(_ % Test), testFrameworks += TestFrameworks.MUnit )