Skip to content

Instantly share code, notes, and snippets.

View rudogma's full-sized avatar

Mikhail Savinov rudogma

View GitHub Profile
@rudogma
rudogma / 0. Scala-Remote-RUN.md
Last active April 16, 2021 14:57
Easy peasy running scala application on remote machine via ssh #scala #remote #ssh

Description

#Steps

  • You should read some code before using. One day pet code, so don't expect much. But it works, if you know why u need it.
  • Run sbt & then execute pack command for desired project. This will use plugin sbt-pack and copy all dependencies (including every jar for dependend projects described in build.sbt ) to the projectname/target/pack/lib folder
  • Step 1st need to be executed every time when you change list of dependencies (so it's no so often)
  • In idea add Run Configuration - remoterun.Run - and set as argument the real path to object that you want to run on remote machine (for example tests.RemoteTestLauncher - or any other existing object with def main(), or extending App or java static method void main )
  • Run this configuration
  • On every run Idea compile every changes automatically, then this script packs class files for every project you specify, copies it to pack directory, syncing on remote and executing via ssh execute.
  • Has safe check of existence .remoterun fi
import io.circe.Encoder
import io.circe.syntax._
trait HasId[ID] {
def id: ID
}
case class MyEntity(field1: Int, id: String) extends HasId[String]
case class CustomId(field1:Int)