Liferay 7服务Gradle依赖未解决

时间:2018-04-24 17:00:14

标签: gradle liferay liferay-7 liferay-service-builder

我尝试在我的网络服务中使用JSON类,但是当我部署我的服务时,它的问题和我的JSON依赖关系,特别是我的build.gradle文件中的这一行: / p>

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

1 个答案:

答案 0 :(得分:1)

我还需要为我的Liferay modicule使用JSON解析器和相关类。我遇到了与你一样的问题以及其他错误。以下内容适用于我(编译和部署正常)。

在build.gradle文件中。

compile group: 'org.json', name: 'json', version: '20131018'

我对java模块类的导入是:

import org.json.JSONArray;
import org.json.JSONObject;

希望这有帮助。