Instead of specifying "Sub-directory Path" of every project to build, I left it empty and defined a custom workspace for jenkins job (sbt compile) to run in.

Unlike "Sub-directory Path", environment variables in field of custom workspace are resolved to values during build process.

Each time I run the job, I shall specify a full path to a scala project.

So what I need is to get a path to project directory as job parameter (pathToProject) and use it to define a custom workspace (${pathToProject}). Checking the box "Use custom workspace" under "General -> Advanced" reveals the field "Directory".