我有一个依赖于Java项目(子项目)的Scala项目。我的项目结构是:
我正在使用GitLab为我的项目下载一些dependency jar,我正在使用GitlabPlugin。
我的构建。sbt:
lazy val root = Project("root-proj", file(".")).dependsOn(childProj)
lazy val childProj = Project("child", file("child")).settings(
libraryDependencies ++= Seq(
"org.jdom" % "jdom" % "1.1.3",
"commons-lang" % "commons-lang" % "2.6",
"junit" % "junit" % "4.12" % Test,
"com.novocode" % "junit-interface" % "0.11" % Test
),
Compile / compile / javacOptions += "-g",
Compile / packageDoc / mappings := Seq()
)
ThisBuild / useCoursier := false
enablePlugins(GitlabPlugin)
import com.gilcloud.sbt.gitlab.{GitlabCredentials, GitlabPlugin}
GitlabPlugin.autoImport.gitlabDomain := "gitlab.com"
GitlabPlugin.autoImport.gitlabCredentials := {
sys.env.get("CI_JOB_TOKEN") match {
// Gitlab CI pipeline
case Some(t) =>
Some(GitlabCredentials("Job-Token", t))
// local machine
case None =>
val c = Credentials
.loadCredentials(Path.userHome / ".sbt" / ".credentials.gitlab")
.left
.map(s => new IllegalArgumentException(s))
.toTry
.get
Some(GitlabCredentials(c))
}
}
字符串
我的plugins.sbt有这一行:addSbtPlugin("com.gilcloud" % "sbt-gitlab" % "0.1.2")
我能够通过注解.dependsOn(childProj)
和childProj
变量成功构建根项目,如果它不依赖于子项目。
但是如果使用Child项目来构建,我会得到以下错误:
[error] stack trace is suppressed; run 'last child / headerAuthHandler' for the full output
[error] stack trace is suppressed; run 'last ssExtractDependencies' for the full output
[error] stack trace is suppressed; run 'last child / ssExtractDependencies' for the full output
[error] (child / headerAuthHandler) java.util.NoSuchElementException: None.get
[error] (ssExtractDependencies) java.util.NoSuchElementException: None.get
[error] (child / ssExtractDependencies) java.util.NoSuchElementException: None.get
型
如果我使用GitLab pipeline运行,问题是在尝试使用IntelliJ本地构建时。
我如何告诉我的子项目使用GitlabPlugin并使用所有GitlabPlugin语句?我尝试使用Project("child", file("child")).enablePlugins(GitlabPlugin).settings(...
,但仍然存在同样的问题。
1条答案
按热度按时间xtfmy6hx1#
我加了一句
字符串
到我的子项目设置,它开始工作。这可能是特定于
sbt-gitlab
插件。