Is scala.actors package gone? - scala

Can not find scala.actors package in latest milestones, while it still presents in scaladocs:
https://oss.sonatype.org/content/groups/public/org/scala-lang/scala-library/2.10.0-M6

The scala-actors library is now a separate artifact. You can add it to your project like
"org.scala-lang" % "scala-actors" % "2.10.0-M6"
It is online here:
https://oss.sonatype.org/content/groups/public/org/scala-lang/scala-actors/2.10.0-M6/

Related

How to install scodec library in scala/sbt?

I have been asked by my developers to have scodec libraries installed on a linux server and I'm lost as I can't find any documentation that points about installing the scodec library!
scodec has 11 repositories in github. This is scodec.org, the official documentation. Seems like the releases page on the docs, is not very updated. So I am going to elaborate on the repositories based on github:
scodec-bits
Provides persistent datatypes for working with bits and bytes.
Add the following into your build.sbt file:
libraryDependencies += "org.scodec" %% "scodec-bits" % "1.1.23"
Maven link. Github link.
scodec-stream
Scodec-stream is a library for streaming binary encoding and decoding. It is built atop scodec and fs2.
Add the following into your build.sbt file:
libraryDependencies += "org.scodec" %% "scodec-stream" % "2.0.0"
Maven link. Github link.
scodec-protocols
Provides models of common binary protocols using the scodec library.
Add the following into your build.sbt file:
libraryDependencies += "org.scodec" %% "scodec-protocols" % "2.0.0"
Maven link. Github link.
scodec
Github link. This package DO NOT publish to Maven central/Sonatype. Hence you cannot fetch it this way. You can try to download one of the releases and read How can I add unmanaged JARs in sbt-assembly to the final fat JAR?
scodec-cats
Integration between scodec and cats.
Add the following into your build.sbt:
libraryDependencies += "org.scodec" %% "scodec-cats" % "1.0.0"
Maven link. Github link.
scodec-build
This repository contains an SBT plugin that is used by the SBT builds of the other scodec modules. It is not intended for direct use.
I will not elaborate about this one. If there is a need for that please comment and I'll add details.
scodec.github.io
No releases yet. Skipping as well. Github link.
scodec-website
Source for scodec.org website. Hence skipping.
scodec-spire
Integration between scodec and spire. This package last publish was at 2016, and it was for Scala 2.11. But you can add it with:
libraryDependencies += "org.scodec" %% "scodec-spire" % "0.4.0"
Maven link. Github link.
I skipped scodec-scalaz and scodec-akka which are archived.
I hope this will give you an idea where to start.

how to add monocle library to my scala project?

i have a scala project using the scala plugin.
I need to use this monocle library, (https://www.optics.dev/Monocle/) for a project, but I just have no idea how to add it to my project.
For sbt projects, there should be a build.sbt file, where I could simply put in something like this:
libraryDependencies ++= Seq(
"com.github.julien-truffaut" %% "monocle-core" % "2.0.3",
"com.github.julien-truffaut" %% "monocle-macro" % "2.0.3",
)
Which should add the dependency for me.
However, I have no idea how I should do this in my current project, and can't really find any leads online, theres no.jar-files anywhere that I can download.
I also tried linking to the library documentation with this thing:
Which did not work.
My directory structure looks like this:

Where can I download the library .jar-files for Akka 2.5.6?

I would like to update from Akka 2.4.10 to the current Akka 2.5.6. For any reasons I can't find a Download-Link on https://akka.io. On Github I found the source files but what I'm looking for are the compiled .class-files bundled in .jar-files, so that I can directly integrate them as library in IntelliJ IDEA. (With version 2.4.10 there was a file "akka_2.11-2.4.10.zip" available for download at https://akka.io, which had these .jar-files in the "lib"-subdirectory.)
You can get the JARs directly from Maven Central, but you should really consider using a build management tool like SBT. You don't even have to install anything, you can just use the one bundled with IntelliJ. Simply create a file named build.sbt in the root of your project with these contents (taken straight from the Akka documentation):
libraryDependencies ++= Seq(
"com.typesafe.akka" %% "akka-actor" % "2.5.6",
"com.typesafe.akka" %% "akka-testkit" % "2.5.6" % Test
)
Open it in IntelliJ and a bar should appear on top of your editor window, prompting you to import the file. This will take care of downloading the appropriate JARs (along with any dependencies).
You should update akka dependency version and your build system would automatically fetch the necessary jar files compatible with the scala version. From here you can find all akka libraries published to maven repository.

Finding resolver and version of dependency, say play-json, in sbt?

Say I want to include a dependency on the play-json library in my sbt file. How and where can I find that information?
I tried searching central repo, play git repository -- couldn't find anything.
First of all, when you want to include a dependency, you've somehow been told about it - about the required version and where to find it. Ask the person this question and you're done. The official source should always be the home page of a dependency.
I'd use http://search.maven.org/ or http://mvnrepository.com/ and pick whatever version is the most current. In your case, however, esp. after the comment where you pointed at Adding Play JSON Library to sbt the answer was right there - in the answers - see https://stackoverflow.com/a/20475410/1305344:
Play 2.2 is out and can be added separately from rest of Play
Framework. in build.sbt:
resolvers += "Typesafe Repo" at "http://repo.typesafe.com/typesafe/releases/"
libraryDependencies += "com.typesafe.play" %% "play-json" % "2.2.1"
The trick is to set up resolvers properly and using the above resolver gives http://repo.typesafe.com/typesafe/releases/com/typesafe/play/play-json_2.10.
When you've got resolvers and any version in your build configuration, you may want to use sbt-updates that's (quoting the plugin's headline) "SBT plugin that can check maven repositories for dependency updates". Quite handy to have it installed as a global plugin, i.e. .sbt/0.13/plugins/sbt-updates.sbt with the following:
resolvers += Classpaths.sbtPluginSnapshots
addSbtPlugin("com.timushev.sbt" % "sbt-updates" % "0.1.6-SNAPSHOT")
When you execute dependencyUpdates you're told what needs version update.
> dependencyUpdates
[info] Found 1 dependency update for superapp
[info] org.jacoco:org.jacoco.agent:jacoco : 0.6.4.201312101107 -> 0.6.5.201403032054 -> 0.7.0.201403182114
[success] Total time: 1 s, completed 2014-03-28 18:30:12
As you can see, I need to upgrade jacoco.
If the project you depend on releases to some known repositories, running sbt-updates regularly will ultimately tell you about the update. I'd strongly recommend reading RELEASE_NOTES for an update before upgrading since it may be introducing some breaking changes you'd rather know about before going to production.

How to override the dependency of an sbt plugin?

I've written an sbt plugin called sbt-jumi which implements sbt integration for Jumi. Right now the sbt-jumi plugin depends on the current Jumi release.
Here is the relevant line from the plugin's build.sbt:
libraryDependencies += "fi.jumi" % "jumi-launcher" % "0.5.376"
And a user of the plugin would add this to his project/plugins.sbt file:
addSbtPlugin("fi.jumi.sbt" % "sbt-jumi" % "0.1.0")
Now let's say that Jumi 0.6.400 is released and it's backward compatible. How can a user of the sbt-jumi plugin configure it to use Jumi 0.6.400, without me having to release a new version of the plugin?
Here is how to do it in Maven. But how to do it in sbt?
Overriding the dependencies of plugins happens the same way as overriding normal dependencies, except that the configuration must be entered into project/plugins.sbt. Overriding dependencies is explained in Library Management. Here is a summary:
If the version you wish to use is greater than the dependency that you would get transitively, sbt will use the larger version by default. You may change the conflict manager to change the default behavior - for example this will create an error on conflict:
conflictManager := ConflictManager.strict
In other words, this in project/plugins.sbt would work:
libraryDependencies += "fi.jumi" % "jumi-launcher" % "0.6.400"
You may check your plugin dependencies using reload plugins and then show update. It should now show the older version as "(EVICTED)".
If the version you wish to use is lower than the default dependency, then you will need to override differently. One way is to force the dependency:
libraryDependencies += "fi.jumi" % "jumi-launcher" % "0.4.350" force()
Another way is to use the dependencyOverrides setting:
dependencyOverrides += "fi.jumi" % "jumi-launcher" % "0.4.350"
The difference between the two methods is that overriding doesn't introduce a direct dependency. I don't think the difference matters for plugins, but for published artifacts it has some differences.