import dependencies on liferay 7.3.2-ga3

fer ros, modified 5 Years ago. New Member Posts: 9 Join Date: 7/6/20 Recent Posts
I found in the liferay pages that from version 7.3 CE GA2 it is easier to import the dependencies with the following line:
 compileOnly group: "com.liferay.portal", name: "release.portal.api", version: "7.3.2-ga3"
but when i try to build the project for an ext package it gives me this error:
1) package com.liferay.portal.security.pwd does not exist import com.liferay.portal.security.pwd.PwdToolkitUtil;
2)error: package com.liferay.portal.security.pwd does not exist
import com.liferay.portal.security.pwd.RegExpToolkit;
                                      ^
3) error: cannot find symbol
                    RegExpToolkit regExpToolkit = new RegExpToolkit();
                                                      ^
  symbol:   class RegExpToolkit
  location: class UserLocalServiceExt4) rror: cannot find symbol
4) error: cannot find symbol
                    newPassword = PwdToolkitUtil.generate(passwordPolicy);
                                  ^
  symbol:   variable PwdToolkitUtil
  location: class UserLocalServiceExt
any suggestions? i know this package is  in:<dependency>
    <groupId>com.liferay.portal</groupId>
    <artifactId>com.liferay.portal.impl</artifactId>
    <version>2.21.0</version>
</dependency>
in fact, if i add this dependency, the project runs without errors, but when i try to deploy this in liferay 7.3.2-ga3 i have the error:Error while starting bundle: file:/data/liferay-ce-portal-7.3.2-ga3/osgi/modules/com.siemens.ecar.ext.service-1.0.0.jar
org.osgi.framework.BundleException: Could not resolve module: com.siemens.ecar.ext.service [1150]_  Unresolved requirement: Import-Package: com.liferay.portal.kernel.exception; version="[7.0.0,8.0.0)"_ [Sanitized]
        at org.eclipse.osgi.container.Module.start(Module.java:444)
        at org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:428)
        at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundle(DirectoryWatcher.java:1297)
        at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundles(DirectoryWatcher.java:1270)
        at org.apache.felix.fileinstall.internal.DirectoryWatcher.startAllBundles(DirectoryWatcher.java:1259)
        at org.apache.felix.fileinstall.internal.DirectoryWatcher.doProcess(DirectoryWatcher.java:519)
        at org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:369)
        at org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:320)
thumbnail
Olaf Kock, modified 5 Years ago. Liferay Legend Posts: 6441 Join Date: 9/23/08 Recent Posts
fer ros:

I know this package is  in:<dependency>
    <groupId>com.liferay.portal</groupId>
    <artifactId>com.liferay.portal.impl</artifactId>
    <version>2.21.0</version>
</dependency>
You shouldn't depend on any impl bundle. They're not APIs, not stable. In fact, it's Liferay's business to change the implementation, only the APIs will be as stable as possible.
Find a way that this class is exposed, or (worst case) copy it into your bundle, because it's not in a position where it's meant to be reused.
Or, go ahead with this not-best-practice import of an impl bundle, but prepare for problems in the future, e.g. the code will be harder to maintain, to you or your successor.
Assume your successor (who will have to maintain your code) knows where you live.
fer ros, modified 5 Years ago. New Member Posts: 9 Join Date: 7/6/20 Recent Posts
Olaf Kock:

fer ros:

I know this package is  in:<dependency>
    <groupId>com.liferay.portal</groupId>
    <artifactId>com.liferay.portal.impl</artifactId>
    <version>2.21.0</version>
</dependency>
You shouldn't depend on any impl bundle. They're not APIs, not stable. In fact, it's Liferay's business to change the implementation, only the APIs will be as stable as possible.
Find a way that this class is exposed, or (worst case) copy it into your bundle, because it's not in a position where it's meant to be reused.
Or, go ahead with this not-best-practice import of an impl bundle, but prepare for problems in the future, e.g. the code will be harder to maintain, to you or your successor. Assume your successor knows where you live.
sorry, i'm new to liferay, and i was given the task of upgrading from version 7.0 to 7.3.2-ga3 ... and in liferay 7.0 build.gradle file there is: 
compileOnly group: "com.liferay.portal", name: "com.liferay.portal.impl", version: "2.21.0"but on this page I found what was mentioned before:  https://liferay.dev/blogs/-/blogs/liferay-portal-7-3-ce-ga2-releasefor that reason I imported the first line by deleting that of com.liferay.portal.impl that was initially there for liferay 7.0