addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.0.6")
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.0")
import com.typesafe.sbt.SbtNativePackager
import com.typesafe.sbt.packager.archetypes.JavaServerAppPackaging
enablePlugins(SbtNativePackager)
enablePlugins(JavaServerAppPackaging)
lazy val commonSettings = Seq(
...
scalaVersion := "2.11.8",
assemblyJarName in assembly := s"${name.value}.jar",
assemblyMergeStrategy in assembly := {
case "BUILD" => MergeStrategy.discard
case other => MergeStrategy.defaultMergeStrategy(other)
}
)
lazy val project1Settings = commonSettings ++ Seq(
rpmVendor := "someOrganisation",
packageDescription in Rpm := "Some description1",
rpmLicense := Some("Copyright 2016 someOrganisation. All rights reserved."),
rpmRequirements := Seq(
"java-1.8.0-openjdk"
),
version in Rpm := "1",
rpmRelease := version.value,
rpmDaemonLogFile := s"${name.value}.log",
daemonUser in Linux := "someUserName",
daemonGroup in Linux := (daemonUser in Linux).value,
rpmPost := Some(
"""|chkconfig --add someService1
|chkconfig someService1 on
""".stripMargin),
linuxPackageMappings ++= Seq() // <--- line 53
)
lazy val project2Settings = commonSettings ++ Seq(
identical to project 1 settings except
packageDescription in Rpm := "Some description2",
rpmPost := Some(
"""|chkconfig --add someService2
|chkconfig someService2 on
""".stripMargin),
linuxPackageMappings ++= Seq() // <--- line 72
)
lazy val project1 = (project in file("components/service1")).settings(project1Settings: _*)
lazy val project2 = (project in file("components/service2")).settings(project2Settings: _*)
在实际项目中,linuxPackageMappings相当复杂,这是我的问题。项目之间的差异。当我将build.sbt加载到sbt中时,我得到错误
References to undefined settings:
project2/*:linuxPackageMappings from project2/*:linuxPackageMappings (~/git/multiprojectissue/build.sbt:72)
project1/*:linuxPackageMappings from project1/*:linuxPackageMappings (~/git/multiprojectissue/build.sbt:53)
at sbt.Init$class.Uninitialized(Settings.scala:265)
...
at xsbt.boot.Boot.main(Boot.scala)
[error] References to undefined settings:
[error]
[error] project2/*:linuxPackageMappings from project2/*:linuxPackageMappings (/Users/ricep02/git/multiprojectissue/build.sbt:72)
[error]
[error] project1/*:linuxPackageMappings from project1/*:linuxPackageMappings (/Users/ricep02/git/multiprojectissue/build.sbt:53)
第53行和第72行标记在上面包含的build.sbt片段I中。
我不知道的事情我在这方面不够熟练,不知道为什么项目有sbt-assembly和sbt-package Manager。我已经对plugins.sbt中的sbt-assembly进行了注释,但仍然遇到了这个问题,所以我现在认为它不是贡献者
似乎需要在Project1
和Project2
的设置中为其启用SBTNativePackager
。
尝试通过添加EnablePlugins(SbtNativePackager)
来修改设置:
lazy val project1Settings = commonSettings ++ Seq(
rpmVendor := "someOrganisation",
packageDescription in Rpm := "Some description1",
rpmLicense := Some("Copyright 2016 someOrganisation. All rights reserved."),
rpmRequirements := Seq(
"java-1.8.0-openjdk"
),
version in Rpm := "1",
rpmRelease := version.value,
rpmDaemonLogFile := s"${name.value}.log",
daemonUser in Linux := "someUserName",
daemonGroup in Linux := (daemonUser in Linux).value,
rpmPost := Some(
"""|chkconfig --add someService1
|chkconfig someService1 on
""".stripMargin),
enablePlugins(SbtNativePackager),
linuxPackageMappings ++= Seq() // <--- line 53
)
项目2也同样如此。
但是,在编译ApplicationA时,SBT抱怨依赖项只能是子目录!!: 这看起来很简单,拥有这个项目依赖项的正确方法是什么?
我有一个sbt插件项目,使用多项目构建。我想使用这个插件作为其他sbt项目的依赖项。我已经创建了一个插件,但是当我把这个插件添加到project中时,我似乎不能正确地连接依赖项。 我在这里漏掉了什么?
我有一个Facelets页面,其中包含
我已经在plugins.sbt文件中添加了sbt-native-packager,1.3.15版。在build.sbt文件中,我使用了enablePlugins(DockerPligin)。当我在sbt shell上运行以下命令时,遇到以下错误: 错误-->
嗨,我是sbt的新手,我正在学习这个教程http://www.scala-sbt.org/0.13/tutorial/Hello.html我在shell上遵循了相同的步骤,程序显示“嗨”,我很困惑,我的hello文件夹中没有这些文件 src/main/scala或src/main/java中的来源 src/test/scala或src/test/java中的测试 src/main/资源或src/t