我在 build.sbt 中进行了以下设置:
lazy val proj = (project in file("."))
.settings(
name := "Proj",
resolvers += Resolver.mavenLocal,
libraryDependencies += "javax.ws.rs" % "javax.ws.rs-api" % "2.1" artifacts( Artifact("javax.ws.rs-api", "", "jar")), // for rescu
libraryDependencies += "com.github.mmazi" % "rescu" % "2.0.2",
)
但是sbt run
出现此错误:
[error] java.lang.NoClassDefFoundError: javax/ws/rs/Path
[error] at si.mazi.rescu.RestInvocationHandler.<init>(RestInvocationHandler.java:61)
Path
类存在于存档中
$ jar -tvf /home/user/.m2/repository/javax/ws/rs/javax.ws.rs-api/2.1/javax.ws.rs-api-2.1.jar | grep Path
...
456 Fri Aug 04 15:17:40 MSK 2017 javax/ws/rs/Path.class
rs api以这种hacky方式添加,因为否则它拒绝插入,但是现在看来可以插入,但是我不知道有什么问题
答案 0 :(得分:0)
通过反复试验,我最终得到了以下一组依赖关系,这些依赖关系解决了此问题:
libraryDependencies += "javax.ws.rs" % "javax.ws.rs-api" % "2.1" artifacts( Artifact("javax.ws.rs-api", "", "jar") ),
libraryDependencies += "javax.ws.rs" % "jsr311-api" % "1.1.1",
libraryDependencies += "org.apache.cxf" % "cxf-rt-frontend-jaxrs" % "3.3.1",
libraryDependencies += "com.github.mmazi" % "rescu" % "2.0.2",