我正在尝试在我的 Web 服务中使用 JSON 类,但是当我部署我的服务时,它和我的 JSON 依赖项存在问题,特别是我的 build.gradle 文件中的这一行:
compile group: "javax.json", name: "javax.json-api", version: "1.1.2"
当我在 Gogo shell 中查看我的服务时,它会显示Installed
,而不是Active
当我手动启动服务时,它会显示:
g! start 809
org.osgi.framework.BundleException: Could not resolve module:
visualization.fileentries.service.service [809]
Unresolved requirement: Import-Package: javax.json; version="[1.1.0,2.0.0)"
此依赖项是否正确声明不正确,或者 Service Builder 不支持此依赖项(或其版本)?
这是 build.gradle:
dependencies {
compileOnly group: "biz.aQute.bnd", name: "biz.aQute.bndlib", version: "3.1.0"
compileOnly group: "com.liferay", name: "com.liferay.osgi.util", version: "3.0.0"
compileOnly group: "com.liferay", name: "com.liferay.portal.spring.extender", version: "2.0.0"
compileOnly group: "com.liferay.portal", name: "com.liferay.portal.kernel", version: "2.6.0"
compileOnly group: "javax.json", name: "javax.json-api", version: "1.1.2"
compile project(":modules:visualization-fileentries-service:visualization-
fileentries-service-api")
}
buildService {
apiDir = "../visualization-fileentries-service-api/src/main/java"
}
group = "visualization.fileentries.service"
和 bnd.bnd 文件:
Bundle-Name: visualization-fileentries-service-service
Bundle-SymbolicName: visualization.fileentries.service.service
Bundle-Version: 1.0.0
Liferay-Require-SchemaVersion: 1.0.0
Liferay-Service: true