sbt-crossproject 发布了名称意外的 jvm 项目

问题描述 投票:0回答:1

我正在尝试同时发布

scalamock
jvm
的几个
js
模块。

我正在使用

sbt-crosspublish
sbt-ci-release

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

问题是 - 它将

scalamock-zio
发布为
ziojvm
。我怎样才能做到
scalamock-zio
呢? https://central.sonatype.com/artifact/org.scalamock/ziojvm_3/7.0.0

我应该添加

withoutSuffixFor(JVMPlatform)
并将sbt项目名称更改为
scalamock-zio
吗?

也不确定为什么

scalamock
发布了具有相同设置的正确内容,而不是
scalamockjvm

预计

zio
cats-effect
模块会发布为
scalamock-zio
而不是
ziojvm
scalamock-cats-effect
而不是
cats-effectjvm

当前

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("http://scalamock.org/")),
    licenses := List(
      "MIT" -> url("https://opensource.org/licenses/MIT")
    ),
    developers := List(
      Developer("paulbutcher", "Paul Butcher", "", url("http://paulbutcher.com/")),
      Developer("barkhorn", "Philipp Meyerhoefer", "", url("https://github.com/barkhorn")),
      Developer("goshacodes", "Georgii Kovalev", "", url("https://github.com/goshacodes"))
    )
  )
)
scala scala.js sbt-crossproject
1个回答
0
投票

添加了

withoutSuffixFor(JVMPlatform)
并将sbt项目名称更改为
scalamock-zio

publishLocal
检查过,有效

© www.soinside.com 2019 - 2024. All rights reserved.