admin管理员组

文章数量:1125746

I'm trying to publish few scalamock modules for jvm and js simultaniously.

I'm using sbt-crosspublish and sbt-ci-release.

addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.9.2")
addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.3.2")

The problem is - it publishes scalamock-zio as ziojvm. How can I make it scalamock-zio instead? .scalamock/ziojvm_3/7.0.0

Should I add withoutSuffixFor(JVMPlatform) and change sbt project name to scalamock-zio?

Also not sure why scalamock published correct having same settings, not scalamockjvm ?

Expecting artifact for zio and cats-effect modules published as scalamock-zio and not ziojvm, scalamock-cats-effect and not cats-effectjvm.

Current build.sbt

import sbtcrossproject.CrossPlugin.autoImport.crossProject

lazy val scalatest = Def.setting("org.scalatest" %%% "scalatest" % "3.2.19")
lazy val specs2 = Def.setting("org.specs2" %%% "specs2-core" % "4.20.8")

val commonSettings = Defaults.coreDefaultSettings ++ Seq(
  scalaVersion := "3.4.3",
  scalacOptions ++= Seq(
    "-deprecation",
    "-unchecked",
    "-feature",
    "-experimental"
  )
)

lazy val root = project.in(file("."))
  .settings(
    publish / skip := true
  )
  .aggregate(
    scalamock.jvm,
    scalamock.js,
    zio.jvm,
    zio.js,
    `cats-effect`.jvm,
    `cats-effect`.js
  )

lazy val scalamock = crossProject(JSPlatform, JVMPlatform)
  .in(file("core"))
  .settings(
    commonSettings,
    name := "scalamock",
    Compile / packageBin / publishArtifact := true,
    Compile / packageDoc / publishArtifact := true,
    Compile / packageSrc / publishArtifact := true,
    Test / publishArtifact := false,
    Compile / doc / scalacOptions ++= Opts.doc.title("ScalaMock") ++
      Opts.doc.version(version.value) ++ Seq("-doc-root-content", "rootdoc.txt", "-version"),
    libraryDependencies ++= Seq(
      scalatest.value % Optional,
      specs2.value % Optional
    ),
  )

lazy val zio = crossProject(JSPlatform, JVMPlatform)
  .in(file("zio"))
  .settings(
    name := "scalamock-zio",
    commonSettings,
    Compile / packageBin / publishArtifact := true,
    Compile / packageDoc / publishArtifact := true,
    Compile / packageSrc / publishArtifact := true,
    Test / publishArtifact := false,
    libraryDependencies ++= {
      val zioVersion = "2.1.14"
      Seq(
        "dev.zio" %%% "zio" % zioVersion,
        "dev.zio" %%% "zio-test" % zioVersion % Test,
        "dev.zio" %%% "zio-test-sbt" % zioVersion % Test
      )
    }
  )
  .dependsOn(scalamock)

lazy val `cats-effect` = crossProject(JSPlatform, JVMPlatform)
  .in(file("cats-effect"))
  .settings(
    name := "scalamock-cats-effect",
    commonSettings,
    Compile / packageBin / publishArtifact := true,
    Compile / packageDoc / publishArtifact := true,
    Compile / packageSrc / publishArtifact := true,
    Test / publishArtifact := false,
    libraryDependencies ++= Seq(
      "org.typelevel" %% "cats-effect" % "3.5.7",
      "org.typelevel" %% "munit-cats-effect" % "2.0.0" % Test
    )
  )
  .dependsOn(scalamock)

lazy val examples = project in file("core/examples") settings(
  commonSettings,
  name := "ScalaMock Examples",
  publish / skip := true,
  libraryDependencies ++= Seq(
    scalatest.value % Test,
    specs2.value % Test
  )
) dependsOn scalamock.jvm

inThisBuild(
  List(
    organization := "org.scalamock",
    homepage := Some(url("/")),
    licenses := List(
      "MIT" -> url(";)
    ),
    developers := List(
      Developer("paulbutcher", "Paul Butcher", "", url("/")),
      Developer("barkhorn", "Philipp Meyerhoefer", "", url(";)),
      Developer("goshacodes", "Georgii Kovalev", "", url(";))
    )
  )
)

本文标签: scalasbtcrossproject publishes jvm project with unexpected nameStack Overflow