What is the final product that scala can produce

I am sorry for annoying community with trivial questions, but it is a complete paradigm shift for me. As I was mentioning in a previous post, I came from high performance computing. The final goal of the software developers (which are very often not software engineers, but physicists, chemists, etc.) is to develop a code. The code is distributed (using git/…) and compiled on different machines by the end users. In other words, end users are competent enough to compile the code (fortran, c++, etc) using make or other more sophisticated tools, resolve library dependencies, etc. The code is then either a stand-alone application or an application that is executed on a cluster using, for instance, mpirun. Let me state again, we distribute source files together with supporting script and Makefile, end users produce executables.

As I understand, this process is very different for the scala developers. I am aware that sbt is a universal tool for building and running applications. I consider it an analogue of make. But you cannot expect that every end user is competent enough to install sbt. The same as end users in my example above do not install all the software infrastructure on a supercomputer. This is a job of engineers.

Therefore my question is, what is the final product that scala programmers produce, how do they distribute their products? Is the end goal to produce a binary file, or a .jar file? By following the tour on scala, I got an impression that all these short pieces of code cannot be the whole story.

As with most things on software, it depends; on many factors like who are your users?
Usually, there are three options:

  1. You are creating a library that is expected to be used by other programmers. Then, you would host your code on a public repository and you would build versioned artifacts that are then pushed to a hosting service like MavenRepository or Sonatype.
  2. You are creating something for your company, usually an HTTP API. Then, you would create a runable artifact, this will depend on your infrastructure. But, usually, it is either an uber JAR that contains everything or all the individual JARs and some bash script that manages the classpath and the entry point; also, you probably will also wrap that on a docker container that already includes the JRE.
  3. You are creating some kind of app that end users can download directly Then, it usually would be an uber JAR or an APK or a ZIP.

And, in general, sbt will handle all those situations for you (by means of a plugin).

2 Likes

Very nice! I would add for completeness for other people who might read this post that a nice discussion of uber JAR files can be found here java - What is an uber jar? - Stack Overflow

1 Like

But I still have a need for some clarification. Why java/scala developers are using Maven Repository or Sonatype repositories but not github, gitlab or bitbucket? They are very common in my field.

Github is a git repository, and git is a source version control tool, so it is used to track source code. Not binaries.

So yes, we use Github to store our source code and manage pull requests and all that as anyone else in this industry.

But we need another kind of repository to store the versioned artifacts that we produce.

1 Like