I am working with Liferay portal-7.4-ga107 (with IntelliJ) and trying to do a training guestbook app following this tutorial from Liferay.
I have followed it perfectly and even repeated the process 3 times, but at the end of the "Integrating the Back-end" step I always encounter this error right after deploying the module/portlet:
error: cannot find symbol
import com.liferay.portal.kernel.uuid.PortalUUID;
^
symbol: class PortalUUID
location: package com.liferay.portal.kernel.uuid
The error seems to be directly related to this dependency in the persistence classes (which are auto-generated in the process):
import com.liferay.portal.kernel.uuid.PortalUUID; //(highlighted as red in code)
Inside the persistence classes, PortalUUID is only "used" here:
@Reference
private PortalUUID _portalUUID;
and here:
String uuid = _portalUUID.generate();
I've done a lot of research and tried a few things, with no luck. The error could be related to something that is outdated and I haven't found, or a change in PortalUUID for my version, I really don't know.
I'm using JDK 8 and gradle 6.9.2
Any help is appreciated, thanks in advance.
Relevant attempts:
I tried to deploy my portlet guestbook-web after finishing this step from the Liferay tutorial, I expected it to get built successfully, but the kernel.uuid.PortalUUID dependency error appeared.
Afterwards, I tried replacing PortalUUID with PortalUUIDUtil, this last one didn't cause any errors in the code, but after deploying the module (guestbook-web), it didn't appear in the portal.
Finally, I saw in Liferay docs that PortalUUIDUtil has a getPortalUUID() method, I tried using PortalUUIDUtil.getPortalUUID(); with no luck (the method doesn't even exist according to my IDE).
Liferay 7.4 (after GA/U 100) requires the workspace version
9.0.4or higher to generate ServiceBuilder code adapted to the changedPortalUUIDAPI.Make sure to configure your Liferay workspace at least like this in your settings.gradle: