How to get full class path on file system for resolved ModuleID in SBT?

心不动则不痛 提交于 2019-12-23 22:58:02

问题


How to corellate artifact from libraryDependencies to its resolved classpath in dependencyClasspath?

UPD

Clarify question: How to get full class path on file system for resolved ModuleID?

Example:

I have ModuleID: "org.eclipse.jetty" % "jetty-servlets" % V.jetty

And I want to knpw that classpath is: C:\Users\user\.ivy2\cache\org.eclipse.jetty\jetty-servlets\jars\jetty-servlets-8.1.8.v20121106.jar


回答1:


You can add a task to your build.sbt and then call it with printDependencyClasspath

val printDependencyClasspath = taskKey[Unit]("Prints location of the dependencies")

printDependencyClasspath := {
  val cp = (dependencyClasspath in Compile).value
  cp.foreach(f => println(s"${f.metadata.get(moduleID.key)} => ${f.data}"))
}


来源:https://stackoverflow.com/questions/23375298/how-to-get-full-class-path-on-file-system-for-resolved-moduleid-in-sbt

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!