简体   繁体   English

Sbt,编译编译器桥

[英]Sbt, compile compiler bridge

I want to build a docker image with sbt. 我想用sbt构建一个docker镜像。

Here is what i have: 这是我有的:

FROM kondaurov/jdk-alpine:jdk8slim

ENV SBT_VERSION=1.2.1

RUN \
 echo "$SBT_VERSION" && \
 curl -fsL https://github.com/sbt/sbt/releases/download/v${SBT_VERSION}/sbt-${SBT_VERSION}.tgz | tar xfz - -C /usr/local && \
 ln -s /usr/local/sbt/bin/* /usr/local/bin/ && \
 sbt sbtVersion

ENTRYPOINT sbt

When i use this image with my scala project i get this: 当我在我的scala项目中使用此图像时,我得到了这个:

[warn] Run 'evicted' to see detailed eviction warnings

[info] Compiling 4 Scala sources to /sbt_project/project/target/scala-2.12/sbt-1.0/classes ...

[info] Non-compiled module 'compiler-bridge_2.12' for Scala 2.12.6. Compiling...

[info]   Compilation completed in 53.746s.

As you see sbt always compiles compiler bridge for scala and it takes some time.. Is it possible to compile bridge in my image? 如你所见sbt总是为scala编译编译器桥,它需要一些时间..是否有可能在我的图像中编译桥? I guess sbt sbtVersion isn't enough 我想sbt sbtVersion还不够

It's triggered on the first compilation, so you can change the sbt sbtVersion line to sbt compile . 它是在第一次编译时触发的,因此您可以将sbt sbtVersion行更改为sbt compile Most likely you will need to add a simple Scala source file in the working directory to trigger the compilation (and then clean up the produced output). 很可能您需要在工作目录中添加一个简单的Scala源文件来触发编译(然后清理生成的输出)。

You can also set a specific Scala version without creating a build.sbt : 您还可以在不创建build.sbt情况下设置特定的Scala版本:

sbt 'set scalaVersion := "2.11.8"' compile

or even several: 甚至几个:

sbt 'set crossScalaVersions := Seq("2.11.8", "2.12.6")' '+compile'

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM