Hi @isso,
The job side works the same way. You only change how the code is packaged. You don't need a separate JAR for each layer. Build a single JAR for the whole project and provide an entry point for each medallion step. For example, you could have com.mycompany.pipeline.BronzeIngest, SilverTransform and GoldAggregate, each with its own main method. Another option is a single main class that reads a parameter like --layer silver and sends it to the right logic. Your shared code (readers, writers, schema definitions, data quality checks) stays within the same project and is reused at every step.
In Lakeflow Jobs, each layer then becomes its own
JAR task. Every task points to the same JAR as a dependent library but uses a different main class, and you chain them with task dependencies so silver runs after bronze and gold runs after silver. One thing to watch for: your code should get its session with SparkSession.builder().getOrCreate() rather than creating a new context, otherwise the run will fail.
The cleanest way to handle the build and deploy cycle is with bundles. The Databricks CLI ships with a Scala template (databricks bundle init default-scala) that builds the JAR, uploads it to a Unity Catalog volume, and creates the job for you when you run Databricks bundle deploy. The
Scala JAR bundle tutorial walks through it step by step.
The page on adding tasks to jobs in bundles lists all the JAR task options, including how to pass parameters to your main method.
Most Scala teams keep their pipeline logic in the JAR so they get proper unit tests, versioning and CI/CD through sbt or Maven. Notebooks are still very handy for exploring data and prototyping a transformation before moving it into the project. You can also attach the JAR to a cluster and call your classes from a Scala notebook to debug them interactively. Jobs can run both notebooks and JARs, so mixing them is fine if your team is used to that, but compiled code is usually easier to maintain over time.
Run databricks bundle init default-scala, get the sample job deploying in your dev target, and then split the sample main class into your bronze, silver and gold entry points. Once that works, add the depends_on chain and you'll have the full medallion flow running from a single build. If you run into problems with JAR compatibility or compute access modes, the
JAR task page links to the build requirements, and that's the first place I'd check.
Hope this helps.
If this answer resolves your question, could you mark it as “Accept as Solution”? That helps other users quickly find the correct fix.
Regards,
Ashwin | Delivery Solution Architect @ Databricks
Helping you build and scale the Data Intelligence Platform.
***Opinions are my own***