How to add a jar file located in root folder to li

2019-08-25 02:33发布

问题:

I have a case where I need to a jar file located in root folder of the project.

I have tried the below :

"ccp.mts.test" % "mts-test_2.12-0.2" % "2.0" from "/mts-test_2.12-0.2.jar"

It did not work. Then I tried like below :

unmanagedJars in Compile += file("lib/mts-test_2.12-0.2.jar")

This also didn't work.

How can I do it?

回答1:

You did not specify the file protocol. Try the following

libraryDependencies += "org.aspectj" % "aspectjrt" % "1.9.2" from ("file://./aspectjrt-1.9.2.jar")

EDIT

I am modifying my answer based on your comment.

In order to provide the absolute path, you can use the following code snippet

val currentDirectory = new java.io.File(".").getCanonicalPath
libraryDependencies += "org.aspectj" % "aspectjrt" % "1.9.2" from ("file://" + currentDirectory + "/aspectjrt-1.9.2.jar")