Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Play activator downloading resources on each run

I am trying to learn Scala by implementing a simple API in Play framework. I am creating an app by command

activator new app play-scala

Then in app folder I'm doing activator run then it starts downloading tons of data from internet. I tried offline:=true in build.sbt and using the offline version activator instead of minimal one but with no success.

[info] Loading project definition from /home/amit/Codes/scala/app/project
[info] Updating {file:/home/amit/Codes/scala/app/project/}app-build...
[info] Resolving org.fusesource.jansi#jansi;1.4 ...
[info] Done updating.
[info] Set current project to app (in build file:/home/amit/Codes/scala/app/)
[info] Updating {file:/home/amit/Codes/scala/app/}root...
[info] Resolving jline#jline;2.12.1 ...
[info] downloading https://repo1.maven.org/maven2/com/typesafe/play/play-omnidoc_2.11/2.5.3/play-omnidoc_2.11-2.5.3.jar ...
[info] downloading http://repo.typesafe.com/typesafe/ivy-releases/com.typesafe.sbtrc/client-2-11/0.3.1/jars/client-2-11.jar ...
[info]  [SUCCESSFUL ] com.typesafe.sbtrc#client-2-11;0.3.1!client-2-11.jar (102499ms)
[info] downloading https://repo1.maven.org/maven2/org/scala-lang/scala-reflect/2.11.5/scala-reflect-2.11.5.jar ...
[info]  [SUCCESSFUL ] org.scala-lang#scala-reflect;2.11.5!scala-reflect.jar (136599ms)
[info] downloading http://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/serialization_2.11/0.1.0/jars/serialization_2.11.jar ...
[info]  [SUCCESSFUL ] org.scala-sbt#serialization_2.11;0.1.0!serialization_2.11.jar (12655ms)
[info] downloading http://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/io_2.11/0.13.8-M3/jars/io_2.11.jar ...

I have a very slow connection and I am stuck with it. I don't know something that easy in python-flask can be so difficult in scala-play or am I missing something?

like image 688
Amit Tripathi Avatar asked Dec 05 '25 07:12

Amit Tripathi


1 Answers

By issuing activator new app play-scala activator only creates a copy of template (usually located at ~/.activator//templates). Of course template itself has to be downloaded first but it is normally tiny.

Effect what you are seeing is that when you run activator run the SBT first time resolves dependencies of your application created according to template. Two situations can happen:

  1. you have already a lot of dependencies in your ~/.ivy2 directory because e.g. you have created project according to the template before or project with similar dependencies via SBT (not strictly with activator). Then the dependencies will be resolved and not downloaded.
  2. you have no dependencies at all in ~/.ivy2 or your template uses such different ones that they have to be downloaded.

Your milage may vary, but important point is that your dependencies are related to your template not activator itself. Another important thing to note is that they have to be definitely downloaded at least once to be used (this is strongly dependent from state of your ~/.ivy2 directory).

I guess that you are trying activator for the first time, or at least play-scala template, thus you have to wait and definitely use better internet connection :)

like image 114
Teliatko Avatar answered Dec 08 '25 01:12

Teliatko