You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Apr 29, 2024. It is now read-only.
When running dockerComposeTest the docker container is created ok. However then the whole project is compiled again and now for some reason using 2.10 (see the line close the end marked with **) instead for reusing the compiled classes in 2.12? Nowhere in my sbt file am I saying 2.10 should be used. Why am I compiling the project again and why do the plugin use 2.10 this time?
import Dependencies._
import java.io.File
lazy val commonSettings = Seq(
version := "0.1.SNAPSHOT",
organization := "com.bfg",
scalaVersion := "2.12.1"
)
enablePlugins(DockerComposePlugin)
docker <<= (docker in bfg) map {(image) => image}
//Set the image creation Task to be the one used by sbt-docker
dockerImageCreationTask := docker.value
lazy val bfg = project
.settings(
name := "bfg",
Defaults.itSettings,
commonSettings,
libraryDependencies ++= commonDeps,
libraryDependencies += "org.scalaj" %% "scalaj-http" % "2.3.0" % "it",
//To use 'dockerComposeTest' to run tests in the 'IntegrationTest' scope instead of the default 'Test' scope:
// 1) Package the tests that exist in the IntegrationTest scope
testCasesPackageTask := (sbt.Keys.packageBin in IntegrationTest).value,
// 2) Specify the path to the IntegrationTest jar produced in Step 1
testCasesJar := artifactPath.in(IntegrationTest, packageBin).value.getAbsolutePath,
// 3) Include any IntegrationTest scoped resources on the classpath if they are used in the tests
testDependenciesClasspath := {
val fullClasspathCompile = (fullClasspath in Compile).value
val classpathTestManaged = (managedClasspath in IntegrationTest).value
val classpathTestUnmanaged = (unmanagedClasspath in IntegrationTest).value
val testResources = (resources in IntegrationTest).value
(fullClasspathCompile.files ++ classpathTestManaged.files ++ classpathTestUnmanaged.files ++ testResources).map(_.getAbsoluteFile).mkString(File.pathSeparator)
},
dockerfile in docker := {
new Dockerfile {
val dockerAppPath = "/app/"
val mainClassString = (mainClass in Compile).value.get
val classpath = (fullClasspath in Compile).value
from("java")
add(classpath.files, dockerAppPath)
entryPoint("java", "-cp", s"$dockerAppPath:$dockerAppPath/*", s"$mainClassString")
}
},
imageNames in docker := Seq(ImageName(
repository = name.value.toLowerCase,
tag = Some("latest"))
)
)
.configs(IntegrationTest)
.enablePlugins(DockerPlugin, DockerComposePlugin)
> dockerComposeTest
Starting Test Pass against a new local Docker Compose instance.
Building a new Docker image.
[info] Updating {file:/Users/henke/Documents/code/scala/bfg6/bfg6/}bfg...
[info] Resolving jline#jline;2.14.1 ...
[info] Done updating.
[warn] There may be incompatibilities among your library dependencies.
[warn] Here are some of the libraries that were evicted:
[warn] * com.typesafe.akka:akka-stream-testkit_2.12:2.4.17 -> 2.5.0
[warn] * com.typesafe.akka:akka-stream_2.12:2.4.17 -> 2.5.0
[warn] Run 'evicted' to see detailed eviction warnings
[info] Compiling 17 Scala sources to /Users/henke/Documents/code/scala/bfg6/bfg6/bfg/target/scala-2.12/classes...
[info] Sending build context to Docker daemon 63.44 MB
[info]
[info] Step 1/3 : FROM java
[info] ---> d23bdf5b1b1b
[info] Step 2/3 : ADD 0/classes 1/scala-library-2.12.1.jar 2/akka-http-cors_2.12-0.2.1.jar 3/scala-java8-compat_2.12-0.8.0.jar 4/akka-stream_2.12-2.5.0.jar 5/akka-actor_2.12-2.5.0.jar 6/config-1.3.1.jar 7/reactive-streams-1.0.0.jar 8/ssl-config-core_2.12-0.2.1.jar 9/scala-parser-combinators_2.12-1.0.4.jar 10/swagger-akka-http_2.12-0.9.1.jar 11/swagger-core-1.5.12.jar 12/commons-lang3-3.2.1.jar 13/jackson-dataformat-yaml-2.8.6.jar 14/jackson-core-2.8.6.jar 15/snakeyaml-1.17.jar 16/swagger-models-1.5.12.jar 17/swagger-annotations-1.5.12.jar 18/guava-18.0.jar 19/validation-api-1.1.0.Final.jar 20/swagger-jaxrs-1.5.12.jar 21/jsr311-api-1.1.1.jar 22/reflections-0.9.10.jar 23/javassist-3.18.2-GA.jar 24/annotations-2.0.1.jar 25/swagger-scala-module_2.12-1.0.3.jar 26/jackson-module-scala_2.12-2.8.6.jar 27/scala-reflect-2.12.1.jar 28/jackson-annotations-2.8.6.jar 29/jackson-databind-2.8.6.jar 30/jackson-module-paranamer-2.8.6.jar 31/paranamer-2.8.jar 32/scalatest_2.12-3.0.1.jar 33/scalactic_2.12-3.0.1.jar 34/scala-xml_2.12-1.0.5.jar 35/util_2.12-2.3.0.jar 36/tagging_2.12-1.0.0.jar 37/akka-http-testkit_2.12-10.0.5.jar 38/akka-stream-testkit_2.12-2.5.0.jar 39/akka-testkit_2.12-2.5.0.jar 40/scalamock-scalatest-support_2.12-3.5.0.jar 41/scalamock-core_2.12-3.5.0.jar 42/akka-http-circe_2.12-1.16.0.jar 43/akka-http_2.12-10.0.6.jar 44/akka-http-core_2.12-10.0.6.jar 45/akka-parsing_2.12-10.0.6.jar 46/circe-core_2.12-0.8.0.jar 47/circe-numbers_2.12-0.8.0.jar 48/cats-core_2.12-0.9.0.jar 49/cats-macros_2.12-0.9.0.jar 50/simulacrum_2.12-0.10.0.jar 51/macro-compat_2.12-1.1.1.jar 52/machinist_2.12-0.6.1.jar 53/cats-kernel_2.12-0.9.0.jar 54/circe-jawn_2.12-0.8.0.jar 55/jawn-parser_2.12-0.10.4.jar 56/cats_2.12-0.9.0.jar 57/cats-kernel-laws_2.12-0.9.0.jar 58/scalacheck_2.12-1.13.4.jar 59/test-interface-1.0.jar 60/discipline_2.12-0.7.2.jar 61/catalysts-platform_2.12-0.0.5.jar 62/catalysts-macros_2.12-0.0.5.jar 63/cats-laws_2.12-0.9.0.jar 64/cats-free_2.12-0.9.0.jar 65/cats-jvm_2.12-0.9.0.jar 66/monocle-core_2.12-1.4.0.jar 67/scalaz-core_2.12-7.2.8.jar 68/monocle-macro_2.12-1.4.0.jar 69/monocle-law_2.12-1.4.0.jar 70/logback-classic-1.1.7.jar 71/logback-core-1.1.7.jar 72/scala-logging_2.12-3.5.0.jar 73/slf4j-api-1.7.21.jar 74/circe-generic_2.12-0.8.0.jar 75/shapeless_2.12-2.3.2.jar 76/circe-parser_2.12-0.8.0.jar 77/macros_2.12-2.3.0.jar /app/
[info] ---> a335a34eff8b
[info] Removing intermediate container aac35aca620c
[info] Step 3/3 : ENTRYPOINT java -cp /app/:/app//* com.bfg.infrastructure.Application
[info] ---> Running in 5ffb5a40920c
[info] ---> cdf9242e1283
[info] Removing intermediate container 5ffb5a40920c
[info] Successfully built cdf9242e1283
[info] Tagging image cdf9242e1283 with name: bfg:latest
Creating Local Docker Compose Environment.
Reading Compose File: /Users/henke/Documents/code/scala/bfg6/bfg6/docker/docker-compose.yml
Created Compose File with Processed Custom Tags: /var/folders/yh/mm1bdmx9073_b15lw69b2qmh0000gn/T/compose-updated7060145577096407405.yml
Pulling Docker images except for locally built images and images defined as <skipPull> or <localBuild>.
Skipping Pull of image: bfg:latest
Creating 488921_bfg_1
Waiting for container Id to be available for service 'bfg' time remaining: 499
bfg Container Id: e7392c25c760
Inspecting container e7392c25c760 to get the port mappings
Docker for Mac environment detected. Using the localhost for the container.
The following endpoints are available for your local instance: 488921
+---------+-----------------+-------------+--------------+----------------+--------------+---------+
| Service | Host:Port | Tag Version | Image Source | Container Port | Container Id | IsDebug |
+=========+=================+=============+==============+================+==============+=========+
| bfg | localhost:32772 | latest | build | 8080 | e7392c25c760 | |
| bfg | localhost:32773 | latest | build | 5005 | e7392c25c760 | DEBUG |
+---------+-----------------+-------------+--------------+----------------+--------------+---------+
Instance commands:
1) To stop instance from sbt run:
dockerComposeStop 488921
2) To open a command shell from bash run:
docker exec -it <Container Id> bash
3) To view log files from bash run:
docker-compose -p 488921 -f /var/folders/yh/mm1bdmx9073_b15lw69b2qmh0000gn/T/compose-updated7060145577096407405.yml logs -f
4) To execute test cases against instance from sbt run:
dockerComposeTest 488921
Compiling and Packaging test cases...
[info] Updating {file:/Users/henke/Documents/code/scala/bfg6/bfg6/}bfg6...
[info] Resolving org.fusesource.jansi#jansi;1.4 ...
[info] Done updating.
**[info] Compiling 14 Scala sources to /Users/henke/Documents/code/scala/bfg6/bfg6/target/scala-2.10/classes...**
[error] /Users/henke/Documents/code/scala/bfg6/bfg6/src/main/scala/com/bfg/infrastructure/server/Server.scala:8: object softwaremill is not a member of package com
[error] import com.softwaremill.tagging._
[error] ^
[error] /Users/henke/Documents/code/scala/bfg6/bfg6/src/main/scala/com/bfg/infrastructure/server/Server.scala:9: object typesafe is not a member of package com
[error] import com.typesafe.scalalogging.LazyLogging
[error] ^
[error] /Users/henke/Documents/code/scala/bfg6/bfg6/src/main/scala/com/bfg/infrastructure/server/Server.scala:18: not found: type LazyLogging
[error] (implicit ac: ActorSystem, afm: ActorMaterializer, ec: ExecutionContext) extends LazyLogging {
[error] ^
[error] /Users/henke/Documents/code/scala/bfg6/bfg6/src/main/scala/com/bfg/infrastructure/server/Server.scala:5: not found: object akka
[error] import akka.http.scaladsl.Http.ServerBinding
[error] ^
...
The text was updated successfully, but these errors were encountered:
Hi @favetelinguis - The project compiles again by default so that all of your latest code changes will be included. You can pass the skipBuild argument to the dockerComposeUp or dockerComposeTest commands if you want to skip the rebuilding the docker image.
From looking at your build.sbt it appears that you are setting the Scala version on bfg project but not specifying anything for the root project which I'm assuming is resulting in a default of 2.10 being used. If you are running dockerComposeTest from the root instead of bfg then that is probably why.
If you update the build.sbt below to specify the root project Scala version as well hopefully that will fix the behavior that you are seeing. You should also be able to run dockerComposeTest from within the bfg project with your current settings.
import java.io.File
name := "akkadocker"
scalaVersion := "2.12.1"
When running dockerComposeTest the docker container is created ok. However then the whole project is compiled again and now for some reason using 2.10 (see the line close the end marked with **) instead for reusing the compiled classes in 2.12? Nowhere in my sbt file am I saying 2.10 should be used. Why am I compiling the project again and why do the plugin use 2.10 this time?
The text was updated successfully, but these errors were encountered: