I am following a beginner's tutorial from here in order to create a service and then consume it from another module (eg. a Portlet)

Everything goes well until I try to deploy it - there is an error in the generated classes: The type com.liferay.petra.sql.dsl.query.DSLQuery cannot be resolved. It is indirectly referenced from required .class files

3

There are 3 best solutions below

0
Victor On BEST ANSWER

Locate build.gradle file and add the following dependency:

compileOnly group: "com.liferay", name: "com.liferay.petra.sql.dsl.api"

Note: you have to add it in both *-api and *-service build.gradle files

0
Jan Verweij On

I prefer using a more generic way that will organize all Liferay related imports for you with just a single line:

compileOnly group: "com.liferay.portal", name: "release.portal.api", version: "7.3.5-ga6"
0
asifaftab87 On

My workspace was working fine and next day when I started my system I faced problem that workspace is invalid, don't know what happened. I took new liferay workspace and then copy pasted my service builder then on deployment I faced this issue. The type com.liferay.petra.sql.dsl.query.DSLQuery cannot be resolved. It is indirectly referenced from required .class files I tried to add

compileOnly group: "com.liferay", name: "com.liferay.petra.sql.dsl.api"

but then facing new issue. I don't think so this import would help, that is something else problem Luckily I had my current workspace in zip format last week as a backup now again I m imported that zip and retried to build service again, now it is working fine. thanks