SBT Assembly remove classes from another JAR

Solution for SBT Assembly remove classes from another JAR
is Given Below:

This is the package structure of my repo:

src
|-- main
    |-- scala
        |-- me.sparker0i.spark
            |-- runner
                |-- Runner.scala
            |-- utils
                |-- Constants.scala
                |-- DatabaseUtils.scala
            |-- service
                |-- Service.scala
                |-- Transform.scala [extends Service]
                |-- Fetch.scala [extends Service]
                |-- <32 more>
            |-- Test.scala

I want to split this application into two such that one application remains the core, while the other uses the core jar as a libraryDependencies:

Core Repo structure:

src
|-- main
    |-- scala
        |-- me.sparker0i.spark
            |-- runner
                |-- Runner.scala
            |-- utils
                |-- Constants.scala
                |-- DatabaseUtils.scala
            |-- service
                |-- Service.scala
            |-- Test.scala

Independent Repo:

src
|-- main
    |-- scala
        |-- me.sparker0i.spark
            |-- service
                |-- Transform.scala [extends Service from Core Repo JAR]
                |-- Fetch.scala [extends Service from Core Repo JAR]
                |-- <32 more>

Now inside the Independent Repo, I’ve referenced the Core Repo JAR inside libraryDependencies. When I do sbt assembly, how do I ensure that I don’t get the contents of the Core JAR inside the Independent JAR? The reason being I will be running the Main class inside the Core JAR, but will also be supplying the Independent JAR as a class path.

Is there some way the above requirement can be achieved using sbt?

You could declare the dependency with scope Provided. This is exactly meant for this use case, i.e. a dependency is provided somehow at runtime but not part of the package.

groupId % core % version % Provided