I have an external java project that my lift project depends on. I have been able to add the dependency to the classes in that project by adding the following line to my sbt:
unmanagedClasspath in Compile += file("[Path to My Project]/classes")
But this project also has a lib folder with a set of jars that it references and I cannot figure out what the correct syntax should be to add these dependencies. Have tried the following but it does not work:
unmanagedJars in Compile += file("[Path to My Project]/lib/*.jar")
Any pointers greatly appreciated
Regards
Des
The libraryDependencies key Most of the time, you can simply list your dependencies in the setting libraryDependencies . It's also possible to write a Maven POM file or Ivy configuration file to externally configure your dependencies, and have sbt use those external configuration files.
To add a dependency to your project, specify a dependency configuration such as implementation in the dependencies block of your module's build. gradle file. This declares a dependency on an Android library module named "mylibrary" (this name must match the library name defined with an include: in your settings.
If you have JAR files (unmanaged dependencies) that you want to use in your project, simply copy them to the lib folder in the root directory of your SBT project, and SBT will find them automatically.
You can use sbt's Path API to get all jars in your directory.
Edit: a shorter version using .classpath
:
unmanagedJars in Compile ++=
(file("[Path to My Project]/lib/") * "*.jar").classpath
which is more or less equivalent to:
unmanagedJars in Compile ++=
Attributed.blankSeq((file("[Path to My Project]/lib/") * "*.jar").get)
(Attributed
is necessary because unmanagedJars
is a setting of type Seq[Attributed[File]]
and not Seq[File]
)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With