<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Akka-Scala - Medium]]></title>
        <description><![CDATA[Akka is a toolkit for building highly concurrent, distributed, and resilient message-driven applications for Java and Scala - Medium]]></description>
        <link>https://medium.com/akka-scala?source=rss----fe89a1cf2275---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Akka-Scala - Medium</title>
            <link>https://medium.com/akka-scala?source=rss----fe89a1cf2275---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 29 Nov 2026 21:36:13 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/akka-scala" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Akka: monitor your applications with Lightbend Telemetry, Prometheus and Grafana Dashboard]]></title>
            <link>https://medium.com/akka-scala/akka-monitor-your-applications-with-lightbend-telemetry-prometheus-and-grafana-dashboard-1b7353e281c1?source=rss----fe89a1cf2275---4</link>
            <guid isPermaLink="false">https://medium.com/p/1b7353e281c1</guid>
            <category><![CDATA[scala]]></category>
            <category><![CDATA[prometheus]]></category>
            <category><![CDATA[akka]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[grafana]]></category>
            <dc:creator><![CDATA[Andrea Cappelletti]]></dc:creator>
            <pubDate>Mon, 18 Apr 2022 01:50:23 GMT</pubDate>
            <atom:updated>2022-04-18T01:47:25.064Z</atom:updated>
            <content:encoded><![CDATA[<p>Me and Dr <a href="https://medium.com/u/51b34544a773">Mark Grechanik</a> are currently working on a research project with Akka Actor and we are exploring different ways to monitor an application in order to obtain useful insights on the system.</p><p>In this article we are going to setup and run Lightbend Telemetry in our Akka application written in Scala using sbt. The process is almost equivalent for Java and any other build tools like Maven and Gradle.</p><p>Anytime you build a production application, mainly highly distributed ones, having insights and metrics to track the behavior of that application is critical for your success.</p><p>Understanding highly distributed and concurrent systems can be challenging.</p><p>Potentially we have a lot of things going on at different times and on other machines. We need somehow to collect insights to understand what is going on in the system and the causes and the effects of our code. These insights can help us debug our application, proactive system maintenance (understanding the causes and the effects), ensure the quality of the service you provide, and much more. You need some way to understand what is happening in your production application. Technically you can write the monitoring functionalities of your system on your own, but this means that you will have to invest a lot of time and a lot of resources trying to wire in the necessary telemetry, and in doing so, you have to scatter that code into your application.</p><p>Lightbend Telemetry is a commercial product designed to provide a very non-intrusive way to gather insights from your Akka applications. It exposes various metrics that can then be visualized using multiple tools. Lightbend monitoring tools will provide a lot of functionalities that will make the monitoring process much easier for you just by integrating it into your application as an external service that you can call through APIs.</p><p><strong>Create a new Scala project</strong></p><p>To start our journey we have to setup a Scala 2 project. The fastest way to do that is to use the “Hello World” templates that sbt. In order to do that, run</p><pre>sbt new scala/hello-world.g8</pre><p>Let’s call our template “telemetry”</p><pre>A template to demonstrate a minimal Scala application</pre><pre>name [Hello World template]: telemetry</pre><p><strong>SBT Version</strong></p><p>The first thing we have to do to start using Lightbend Telemtry in our Scala 3 project is to make sure that we have a proper version of sbt for our project, so let’s check project/build.properties and make sure that sbt version is equivalent or higher that <strong>1.0.0.</strong></p><p>For our purposes we will use sbt version 1.6.2 and your build.properties will look like this</p><pre>sbt.version=1.6.2</pre><p><strong>Commercial credentials</strong></p><p>Second, we need to get out commercial credentials from the Lightbend website. Lightbend Telemetry is a monitoring tool under license and in order to get the credentials a subscription is needed.</p><p>Create a Lightbend Account <a href="https://www.lightbend.com/account/login/redirect">here</a></p><p>Once you have created your Lightbend Account, retrieve the platform credentials from <a href="https://www.lightbend.com/account/lightbend-platform/credentials">here</a></p><p>Go under the section credentials and sbt.</p><p>Create a file named lightbend.sbt in your project root and copy and paste the credentials you get from Lightbend website. Your file will look like</p><pre>ThisBuild / <em>resolvers </em>+= &quot;lightbend-commercial-mvn&quot; at &quot;https://repo.lightbend.com/pass/<strong>mykey</strong>/commercial-releases&quot;</pre><pre>ThisBuild / <em>resolvers </em>+= <em>Resolver</em>.<em>url</em>(&quot;lightbend-commercial-ivy&quot;, <em>url</em>(&quot;https://repo.lightbend.com/pass/<strong>mykey</strong>/commercial-releases&quot;))(<em>Resolver</em>.ivyStylePatterns)</pre><p>Pay attention to this known bug</p><p>If using sbt version 1.[0–2] you will need to set updateOptions := updateOptions.value.withGigahorse(false) in your build.sbt to avoid a known bug which could cause an issue with resolution.</p><p><strong>Add the Cinnamon Plugin to our project</strong></p><p>In order to add the Cinnamon plugin, we have to create a file named plugins.sbt under the directory /project. The content of the file will look like this</p><pre>addSbtPlugin(&quot;com.lightbend.cinnamon&quot; % &quot;sbt-cinnamon&quot; % &quot;2.16.2&quot;)</pre><p><strong>Enable Cinnamon in build.sbt</strong></p><p>Next step is to enable Cinnamon from our build.sbt file, in order to do that we will add enablePlugins (Cinnamon) to our root project.</p><p>Our build.sbt will look like</p><pre>lazy val root = (project in <em>file</em>(&quot;.&quot;)).<br>  settings(<br>    inThisBuild(<em>List</em>(<br>      <em>organization </em>:= &quot;com.nuklex.scala&quot;,<br>      <em>scalaVersion </em>:= &quot;2.13.8&quot;<br>    )),<br>    <em>name </em>:= &quot;telemetry&quot;<br>  ) enablePlugins Cinnamon</pre><p>If using Lightbend Telemetry (Cinnamon) version 2.12.x or older you will need to set enablePlugins(<strong>CinnamonAgentOnly</strong>) <a href="https://developer.lightbend.com/docs/telemetry/current/setup/cinnamon-agent-sbt.html#lightbend-telemetry-sbt-plugin">instead of </a><a href="https://developer.lightbend.com/docs/telemetry/current/setup/cinnamon-agent-sbt.html#lightbend-telemetry-sbt-plugin">enablePlugins(</a><a href="https://developer.lightbend.com/docs/telemetry/current/setup/cinnamon-agent-sbt.html#lightbend-telemetry-sbt-plugin"><strong>Cinnamon</strong></a><a href="https://developer.lightbend.com/docs/telemetry/current/setup/cinnamon-agent-sbt.html#lightbend-telemetry-sbt-plugin">)</a> (in build.sbt) so that the correct resolvers are used.</p><p><strong>Enable Lightbend Telemetry</strong></p><p>So far we have setup our project to include the plugin of Lightbend Telemetry. Next step is to enable it, to achieve that we have to explicitly add in our build.sbt</p><pre>// Add the Cinnamon Agent for run and test<br>run / cinnamon := true<br>test / cinnamon := true</pre><p>Our build.sbt will look like this in the end</p><pre>lazy val root = (project in <em>file</em>(&quot;.&quot;)).<br>  settings(<br>    inThisBuild(<em>List</em>(<br>      <em>organization </em>:= &quot;com.nuklex.scala&quot;,<br>      <em>scalaVersion </em>:= &quot;2.13.8&quot;<br>    )),<br>    <em>name </em>:= &quot;telemetry&quot;<br>  ) enablePlugins Cinnamon<br><br>// Add the Cinnamon Agent for run and test<br><em>run </em>/ <em>cinnamon </em>:= true<br><em>test </em>/ <em>cinnamon </em>:= true</pre><p><strong>Run Akka Actor application with Lightbend Telemetry</strong></p><p>And now the fun part, let’s add Akka Actor ( “com.typesafe.akka” %% “akka-actor” % “2.6.19”)to our project and the Lightbend Telemetry dependency (Cinnamon.<em>library</em>.<em>cinnamonAkkaTyped</em>) and the related Prometheus dependencies.</p><pre>lazy val root = (project in <em>file</em>(&quot;.&quot;)).<br>  settings(<br>    inThisBuild(<em>List</em>(<br>      <em>organization </em>:= &quot;com.nuklex.scala&quot;,<br>      <em>scalaVersion </em>:= &quot;2.13.8&quot;<br>    )),<br>    <em>name </em>:= &quot;telemetry&quot;,<br>    <em>libraryDependencies </em>++=<br>      <em>Seq</em>(<br>        // Akka Actor<br>        &quot;com.typesafe.akka&quot; %% &quot;akka-actor&quot; % &quot;2.6.19&quot;,<br>        // Lightbend Telemetry<br>        Cinnamon.<em>library</em>.<em>cinnamonAkkaTyped</em>,<br>        Cinnamon.<em>library</em>.<em>cinnamonPrometheus</em>,<br>        Cinnamon.<em>library</em>.<em>cinnamonPrometheusHttpServer</em>,<br>      )<br>  ) enablePlugins Cinnamon<br><br>// Add the Cinnamon Agent for run and test<br><em>run </em>/ <em>cinnamon </em>:= true<br><em>test </em>/ <em>cinnamon </em>:= true</pre><p>Let’s configure our application.conf to report Lightbend metrics and the Prometheus backend exporters.</p><p>For this example we will be reporting actors by class. The config will be automatically fetched from the application.</p><pre>cinnamon.application = &quot;telemetry&quot;<br><br>cinnamon.akka {<br>  actors = {<br>    default-by-class {<br>      includes = &quot;/user/*&quot;<br>      report-by = class<br>    }<br>  }<br>}<br>cinnamon.prometheus {<br>  exporters += http-server<br>}</pre><p>Let’s create a HelloWorld Actor to test our Telemetry sandbox.</p><p>The class will look like</p><pre>import akka.actor.Actor<br><br>class HelloActor extends Actor {<br>  def receive = {<br>    case &quot;hello&quot; =&gt; <em>println</em>(&quot;hello back at you&quot;)<br>    case _ =&gt; <em>println</em>(&quot;huh?&quot;)<br>  }<br>}</pre><p>Now let’s implement a simple Main to send messages to our Actor</p><pre>import akka.actor.{ActorSystem, Props}<br><br>object Main extends App {<br>  val <em>actorSystem </em>= <em>ActorSystem</em>(&quot;actorSystem&quot;)<br>  val <em>actor </em>= <em>actorSystem</em>.actorOf(<em>Props</em>[HelloActor], &quot;helloActor&quot;)<br>  (1 to 10).foreach { _ =&gt;<br>    <em>actor </em>! &quot;hello&quot;<br>    Thread.<em>sleep</em>(3000)<br>  }<br>}</pre><p>Let’s run the application with sbt via command line and make sure that everything’s working as expected. Run</p><p>sbt clean compile</p><p>And</p><p>sbt run</p><p>In the output console you should see</p><pre>[info] running (fork) Main <br>[info] [INFO] [04/17/2022 20:24:52.112] [main-1] [Cinnamon] Agent version 2.16.2<br>[info] [INFO] [04/17/2022 20:24:52.427] [main-1] [Cinnamon] Agent found Java Futures version: 1.8.0_321<br>[info] [INFO] [04/17/2022 20:24:52.536] [main-1] [Cinnamon] Agent found Akka Actor version: 2.6.19<br>[info] [INFO] [04/17/2022 20:24:52.538] [main-1] [Cinnamon] Agent found Scala version: 2.13.8<br>[info] [INFO] [04/17/2022 20:24:52.577] [main-1] [Cinnamon] Agent found Akka version: 2.6.19<br>[info] [INFO] [04/17/2022 20:24:52.594] [main-1] [Cinnamon] Agent found Scala Futures version: 2.13.8<br>[info] hello back at you<br>[info] hello back at you<br>...</pre><p>As you notice sbt will automatically invoke the lightbend agent and start it.</p><p>If instead you want to run the application from your IDE you should specify the lightbend jar agent path manually.</p><p>For example in IntelliJ you should go to configuration and add</p><p>-javaagent path/to/cinnamon-agent.jar</p><p>sbt does it automatically.</p><p><strong>Download Grafana Monitoring Dashboard and Prometheus Backend</strong></p><p>The fastest way to see the insights of Lightbend Telemetry on our machine is via Grafana frontend dashboard, Prometheus backend. In this guide we will use the docker container image of that combo to visualize the insights from our application.</p><p>First thing first install docker <a href="https://docs.docker.com/get-docker/">https://docs.docker.com/get-docker/</a></p><p>Then make sure that docker is up and running and download the docker image of the developer sandbox from <a href="https://downloads.lightbend.com/cinnamon/sandbox/cinnamon-prometheus-docker-sandbox-2.16.2.zip">here</a></p><p>Unzip the archive and cd into the directory cd cinnamon-prometheus-docker-sandbox-2.16.2/</p><p>Now run docker-compose up to start the sandbox and go on your browser at the address <a href="http://localhost:3000/login">http://localhost:3000/login</a>. You will find the Grafana login</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yd6vdRRLam3uJvZ1t43VkA.png" /></figure><p>Sign in with “admin” and “admin” you will see the starting dashboard</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KHzHOqL1Q9SGTxdMOavmXw.png" /></figure><p>Enable the Cinnamon Prometheus plugin</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bh2pWIMMS5R0kkT7fRoHhg.png" /></figure><p>Once enabled go to the Akka Actor dashboard</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tT0R4FlaLt83eJvWWs8e8g.png" /></figure><p>Let’s set “refreshing every” to 5 seconds in the dashboard settings</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ba1wANQxc-R_En9IQZUtvQ.png" /></figure><p>Now let’s run our simple application via sbt</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DaLIpEzBJqFjf8Z_MAjGhw.png" /></figure><p>You should be able to see the insights displaying on the Grafana dashboard.</p><p>That’s all!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1b7353e281c1" width="1" height="1" alt=""><hr><p><a href="https://medium.com/akka-scala/akka-monitor-your-applications-with-lightbend-telemetry-prometheus-and-grafana-dashboard-1b7353e281c1">Akka: monitor your applications with Lightbend Telemetry, Prometheus and Grafana Dashboard</a> was originally published in <a href="https://medium.com/akka-scala">Akka-Scala</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Scala 3: create an sbt project with subprojects and build the fat jar]]></title>
            <link>https://medium.com/akka-scala/scala-3-create-an-sbt-project-with-subprojects-and-build-the-fat-jar-1b992643eb59?source=rss----fe89a1cf2275---4</link>
            <guid isPermaLink="false">https://medium.com/p/1b992643eb59</guid>
            <category><![CDATA[scala]]></category>
            <category><![CDATA[dotty]]></category>
            <category><![CDATA[scala-3]]></category>
            <category><![CDATA[akka]]></category>
            <category><![CDATA[java]]></category>
            <dc:creator><![CDATA[Andrea Cappelletti]]></dc:creator>
            <pubDate>Fri, 11 Feb 2022 01:59:37 GMT</pubDate>
            <atom:updated>2022-02-11T01:59:37.750Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1NwKq3dLbQFYBmev2qLkKA.png" /></figure><p>During the past few weeks, me and Dr. <a href="https://medium.com/u/51b34544a773">Mark Grechanik</a> have been working on a research project entirely in Scala 3. After many attempts, we realized that all the dependencies we needed for our project were unavailable in Scala 3. So we decided to build a project with Scala 2 submodules.</p><p>In this article, we will see how to create a Scala 3 project with multiple subprojects.</p><p>First, we will see how to configure the build.sbt properly and how to create dependencies between the projects.</p><p>Second, we will build a fat jar that compiles Scala 3 and includes all the subprojects as a module dependency.</p><p>The subprojects can be hybrid Scala 3 or Scala 2.</p><p>For this article, we will create a Scala 3 project that contains two subprojects: project A that builds and compiles in Scala 3 and project B that builds and compiles in Scala 2.</p><p>Let&#39;s start with creating a Scala 3 project that will be the orchestrator of all the other subprojects. To do that, open a command line and run</p><pre>$ sbt new scala/scala3.g8</pre><p>It will ask you for a name, let&#39;s call it &quot;orchestrator&quot;</p><pre>A template to demonstrate a minimal Scala 3 application</pre><pre>name [Scala 3 Project Template]: orchestrator</pre><pre>Template applied in /Users/andreacappelletti/Desktop/./orchestrator</pre><p>Now let&#39;s move into the project&#39;s directory and create the two subprojects used from the orchestrator as modules.</p><pre>$ cd orchestrator</pre><p>To create the Scala 3 subproject, we do the same that we have done for the orchestrator. We will call it &quot;projectA&quot;</p><pre>$ sbt new scala/scala3.g8</pre><pre>A template to demonstrate a minimal Scala 3 application</pre><pre>name [Scala 3 Project Template]: projectA</pre><pre>Template applied in /Users/andreacappelletti/Desktop/orchestrator/./projecta</pre><p>Now let&#39;s create the Scala 2 subproject. We will call it &quot;projectB&quot;</p><p>To do that, run</p><pre>$ sbt new scala/hello-world.g8</pre><pre>A template to demonstrate a minimal Scala application</pre><pre>name [Hello World template]: projectB</pre><pre>Template applied in /Users/andreacappelletti/Desktop/orchestrator/./projectb</pre><p>At this point, we have a Scala 3 project (the orchestrator) with two subprojects, one in Scala 3 and the other in Scala 2.</p><p>We want our orchestrator to handle the dependencies and plugins for the other two subprojects; in this way, we can manage the entire project from just one build.sbt and a unique /project folder in which we add additional plugins.</p><p>To achieve this, we delete the build.sbt and the folder /project for the two subprojects (projectA and projectB).</p><p>The tree structure of the project should look like this</p><pre>$ tree<br>.<br>├── README.md<br>├── build.sbt<br>├── project<br>│ └── build.properties<br>├── projecta<br>│ ├── README.md<br>│ └── src<br>│ ├── main<br>│ │ └── scala<br>│ │ └── Main.scala<br>│ └── test<br>│ └── scala<br>│ └── Test1.scala<br>├── projectb<br>│ └── src<br>│ └── main<br>│ └── scala<br>│ └── Main.scala<br>└── src<br> ├── main<br> │ └── scala<br> │ └── Main.scala<br> └── test<br> └── scala<br> └── Test1.scala</pre><pre>16 directories, 9 files</pre><p>At this point, we have to declare the dependencies of the two subprojects into the build.sbt of the orchestrator.</p><pre>val scala3Version = &quot;3.1.1&quot;<br><br>lazy val root = project<br> .in(<em>file</em>(&quot;.&quot;))<br> .settings(<br> <em>name </em>:= &quot;orchestrator&quot;,<br> <em>version </em>:= &quot;0.1.0-SNAPSHOT&quot;,<br> <em>scalaVersion </em>:= scala3Version,<br> <em>libraryDependencies </em>++= <em>Seq</em>(&quot;com.novocode&quot; % &quot;junit-interface&quot; % &quot;0.11&quot; % &quot;test&quot;)<br> ) aggregate(projectA, projectB) dependsOn(projectA, projectB)<br><br>lazy val projectA = project<br> .in(<em>file</em>(&quot;projectA&quot;))<br> .settings(<br> <em>name </em>:= &quot;projectA&quot;,<br> <em>version </em>:= &quot;0.1.0-SNAPSHOT&quot;,<br> <em>scalaVersion </em>:= scala3Version,<br> <em>libraryDependencies </em>++= <em>Seq</em>(&quot;com.novocode&quot; % &quot;junit-interface&quot; % &quot;0.11&quot; % &quot;test&quot;)<br> )<br><br>lazy val projectB = project<br> .in(<em>file</em>(&quot;projectB&quot;))<br> .settings(<br> <em>name </em>:= &quot;projectB&quot;,<br> <em>scalaVersion </em>:= &quot;2.13.3&quot;,<br> //Scala 2 dependencies<br> <em>libraryDependencies </em>++= <em>Seq</em>()<br> )</pre><p>Note the keywords aggregate and dependsOn on the orchestrator declaration.</p><p>The first keyword, aggregate, allows us to execute tasks in the aggregator module, in this case, the orchestrator. As a consequence, we will export just a single fat jar.</p><p>Meanwhile, dependesOn, allows us to refer to classes, objects, and values of projectA and projectB from the orchestrator.</p><p>Let&#39;s dive into an example and create two packages inside the two subprojects. We will call them ProjectA and ProjectB, respectively.</p><p>Now let&#39;s move the Main object into those packages and declare a string.</p><p>ProjectA will look like</p><pre>package ProjectA<br><br>object MainProjectA:<br>  val <em>message </em>= &quot;Hello from ProjectA, I was compiled with Scala3! :)&quot;</pre><p>Meanwhile ProjectB</p><pre>package ProjectB<br><br>object MainProjectB {<br>  val <em>message </em>= &quot;Hello from ProjectB, I was compiled with Scala2! :)&quot;<br>}</pre><p>Now, from the Main of the orchestrator let&#39;s import the two messages and print them.</p><pre>import ProjectA.MainProjectA<br>import ProjectB.MainProjectB<br><br>object Main:<br>  @main def hello: Unit =<br>    <em>println</em>(&quot;Hello from the orchestrator!&quot;)<br>    <em>println</em>(MainProjectA.<em>message</em>)<br>    <em>println</em>(MainProjectB.<em>message</em>)</pre><p>Now let&#39;s compile the project</p><pre>$ sbt clean compile<br>[info] compiling 1 Scala source to /Users/andreacappelletti/Desktop/orchestrator/projectB/target/scala-2.13/classes …<br>[info] compiling 1 Scala source to /Users/andreacappelletti/Desktop/orchestrator/projectA/target/scala-3.1.1/classes …<br>[info] compiling 1 Scala source to /Users/andreacappelletti/Desktop/orchestrator/target/scala-3.1.1/classes …<br>[success] Total time: 15 s, completed Feb 10, 2022 7:28:35 PM</pre><p>As we can see, different compilers are instantiated. The Scala 3 compiler will compile the orchestrator and the subproject B. Meanwhile, the Scala 2 compiler will compile subproject B.</p><p>If we run the project, we will get</p><pre>$ sbt run<br>[info] running hello <br>Hello from the orchestrator!<br>Hello from ProjectA, I was compiled with Scala3! :)<br>Hello from ProjectB, I was compiled with Scala2! :)<br>[success] Total time: 7 s, completed Feb 10, 2022 7:30:12 PM</pre><p>What if we want to build the fat jar of the entire project?</p><p>To do that, we have to add the plugin sbt assembly to the project.</p><p>Create a new file &quot;plugins.sbt&quot; in the /project folder and insert</p><pre>addSbtPlugin(&quot;com.eed3si9n&quot; % &quot;sbt-assembly&quot; % &quot;1.1.0&quot;)</pre><p>Add these two lines in the build.sbt to give the jar a name</p><pre>val jarName = &quot;orchestrator.jar&quot;<br><em>assembly</em>/<em>assemblyJarName </em>:= jarName</pre><p>Extract the project dependencies and from the terminal run</p><pre>$ sbt clean assembly</pre><p>A fat jar will all the subprojects modules dependencies will be built, and you can find it under the folder /target/scala-3.1.1/orchestrator.jar</p><p>To test it, run</p><pre>$ cd target/scala-3.1.1</pre><p>And run</p><pre>$ java -jar orchestrator.jar</pre><pre>Hello from the orchestrator!<br>Hello from ProjectA, I was compiled with Scala3! :)<br>Hello from ProjectB, I was compiled with Scala2! :)</pre><p>You can find the code template on my GitHub</p><p><a href="https://github.com/andreacappelletti97/scala3-multiproject-template.git">https://github.com/andreacappelletti97/scala3-multiproject-template.git</a></p><p>That&#39;s all!</p><p>References</p><p><a href="https://www.scala-sbt.org/1.x/docs/Multi-Project.html">https://www.scala-sbt.org/1.x/docs/Multi-Project.html</a></p><p><a href="https://eed3si9n.com/sbt-assembly-1.0.0">https://eed3si9n.com/sbt-assembly-1.0.0</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1b992643eb59" width="1" height="1" alt=""><hr><p><a href="https://medium.com/akka-scala/scala-3-create-an-sbt-project-with-subprojects-and-build-the-fat-jar-1b992643eb59">Scala 3: create an sbt project with subprojects and build the fat jar</a> was originally published in <a href="https://medium.com/akka-scala">Akka-Scala</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Scala 3+ with Akka is it really possible?]]></title>
            <link>https://medium.com/akka-scala/scala-3-with-akka-is-it-really-possible-43edae68fa4f?source=rss----fe89a1cf2275---4</link>
            <guid isPermaLink="false">https://medium.com/p/43edae68fa4f</guid>
            <category><![CDATA[scala-3]]></category>
            <category><![CDATA[akka]]></category>
            <category><![CDATA[functional-programming]]></category>
            <category><![CDATA[scala]]></category>
            <category><![CDATA[cloud-comput]]></category>
            <dc:creator><![CDATA[Andrea Cappelletti]]></dc:creator>
            <pubDate>Sun, 06 Feb 2022 22:10:46 GMT</pubDate>
            <atom:updated>2022-01-14T16:14:24.281Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rMizAdTzh-WL-y04dVM2mg.png" /></figure><p>In this article, we are going to see how to use Scala 3 with Akka.</p><p>Recently Akka has released experimental support for Scala 3 as we can see from their official documentation: <a href="https://doc.akka.io/docs/akka/snapshot/project/scala3.html">https://doc.akka.io/docs/akka/snapshot/project/scala3.html</a></p><p>There are mainly two ways to use Scala 3 with Akka: the first one requires CrossVersion, which basically means using Scala 2.13 libraries in Scala 3.</p><p>All we have to do is set our build.sbt like this</p><pre><em>// build.sbt</em> <br><strong>lazy</strong> <strong>val</strong> hello = project.in(file(&quot;.&quot;))   <br>   .settings(     <br>       scalaVersion := &quot;3.0.0-RC2&quot;,     <br>       libraryDependencies +=       <br>          (&quot;org.typelevel&quot; %% &quot;cats-core&quot; % &quot;x.y.z&quot;)<br>          .cross(<strong>CrossVersion</strong>.for3Use2_13)<br>    )</pre><p>The Scala 3 compiler is able to type check Scala 2.13 types and to resolve Scala 2.13 implicits. It means you can safely use Scala 2.13 libraries in a Scala 3 application.</p><p>More information are available at <a href="https://scala-lang.org/blog/2021/04/08/scala-3-in-sbt.html#using-scala-213-libraries-in-scala-3">https://scala-lang.org/blog/2021/04/08/scala-3-in-sbt.html#using-scala-213-libraries-in-scala-3</a></p><p>The second option is to use Scala 3 directly without the need for CrossVersion. This is possible only starting from Akka version 2.6.18.</p><pre><em>// build.sbt</em><br>lazy val root = project<br>  .in(<em>file</em>(&quot;.&quot;))<br>  .settings(<br>    <em>name </em>:= &quot;MyProjectName&quot;,<br>    <em>version </em>:= &quot;0.1&quot;,<br>    <em>scalaVersion </em>:= &quot;3.0.2&quot;<br>  )</pre><pre>val akkaActorVersion = &quot;2.6.18&quot;</pre><pre><em>libraryDependencies </em>++= <em>Seq</em>(<br>    &quot;com.typesafe.akka&quot; %% &quot;akka-actor&quot; % akkaActorVersion<br>)</pre><p>The project will compile and use directly Scala 3 version.</p><p>That’s all!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=43edae68fa4f" width="1" height="1" alt=""><hr><p><a href="https://medium.com/akka-scala/scala-3-with-akka-is-it-really-possible-43edae68fa4f">Scala 3+ with Akka is it really possible?</a> was originally published in <a href="https://medium.com/akka-scala">Akka-Scala</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>