I have a project running simple built tool as building tool. All of my sub projects are sharing the same dependencies, so I want them to use the same lib folder. I could do so by creating symbolic links to my shared lib folder, but I hope to find a configuration in sbt that lets me change to path of my libraries.
override def dependencyPath = ".." / "lib"
does not work, ".." is not allowed in paths
class Top(info:ProjectInfo) extends ParentProject(info){
lazy val subproject = project("sub","Sub Project",info => SubProject(info,dependencyPath)
class SubProject extends DefaultProject(info:ProjectInfo,libdir:Path){
override def dependencyPath = libdir
}
}
does not work, dependencyPath is a project relative path
dependencyPath.absolutePath
does not work either, because absolutePath creates a String with slashes, and paths may not be created from strings with slashes.
If you simply want to add the parent project's unmanaged classpath (i.e. lib
-directory) to the child projects you can do something like this:
class ParentProject(info: ProjectInfo) extends DefaultProject(info) { parent =>
class SubProject(info: ProjectInfo) extends DefaultProject(info) {
override def unmanagedClasspath =
parent.unmanagedClasspath +++ super.unmanagedClasspath
}
val someProject = project("test", "Test", new SubProject(_))
}
Defining paths in the ParentProject
class (e.g. using val dirJars = descendents("dir", "*.jar")
) and adding them to SubProject
the same way as above also works.
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