Message Boards

Unresolved requirement: Import-Package: com.liferay.portal.kernel.util;

Amit sinha, modified 5 Years ago.

Unresolved requirement: Import-Package: com.liferay.portal.kernel.util;

New Member Posts: 17 Join Date: 6/4/15 Recent Posts

Hi All,

I am using com.liferay.portal.kernel.util package in my portlet in liferay 7.1.

but at deployment time i am getting below error in gogo shell console.

Unresolved requirement: Import-Package: com.liferay.portal.kernel.util; version="[7.0.0,8.0.0)".

below is  my build.gradle

dependencies {
    compileOnly group: "com.liferay.portal", name: "com.liferay.portal.kernel", version: "2.0.0"
    compileOnly group: "com.liferay.portal", name: "com.liferay.util.taglib", version: "2.0.0"
    compileOnly group: "javax.portlet", name: "portlet-api", version: "2.0"
    compileOnly group: "javax.servlet", name: "javax.servlet-api", version: "3.0.1"
    compileOnly group: "jstl", name: "jstl", version: "1.2"
    compileOnly group: "org.osgi", name: "osgi.cmpn", version: "6.0.0"
}

Thanks in advance !

   

thumbnail
Victor Zorin, modified 5 Years ago.

RE: Unresolved requirement: Import-Package: com.liferay.portal.kernel.util;

Liferay Legend Posts: 1228 Join Date: 4/14/08 Recent Posts

try to remove the line:

compileOnly group: "com.liferay.portal", name: "com.liferay.portal.kernel", version: "2.0.0"

 

and if you use maven add the following dependency:

        <dependency>
            <groupId>com.liferay.portal</groupId>
            <artifactId>com.liferay.portal.kernel</artifactId>
            <version>3.0.0</version>
            <scope>provided</scope>
        </dependency>
 

Just  make sure that as the result of the build the META-INF/MANIFEST.MF file contains the following line in the Import-Package: section:

com.liferay.portal.kernel.model;version="[2.0,3)"

 

It gets much trickier if you want the same module to work on 7.0 and 7.1, your build must produce the following entry in the manifest:

com.liferay.portal.kernel.model;version="[1.0,3)"

Amit sinha, modified 5 Years ago.

RE: Unresolved requirement: Import-Package: com.liferay.portal.kernel.util;

New Member Posts: 17 Join Date: 6/4/15 Recent Posts

Thanks Victor, it is working for me after changed version of com.liferay.portal.kernel

 compileOnly group: "com.liferay.portal", name: "com.liferay.portal.kernel", version: "3.0.0"

thumbnail
Sean Gildea, modified 5 Years ago.

RE: Unresolved requirement: Import-Package: com.liferay.portal.kernel.util;

New Member Posts: 20 Join Date: 12/15/12 Recent Posts

Confirmed. I also had the same error and changing the version from 2.0.0 to 3.0.0 fixed it

Thanks!

Sean

thumbnail
Jobin Mathew, modified 4 Years ago.

RE: Unresolved requirement: Import-Package: com.liferay.portal.kernel.util;

Junior Member Posts: 77 Join Date: 7/4/14 Recent Posts
 I also had the same error in Liferay 7.1 and changing the version from 2.0.0 to 3.0.0 fixed itThanks!Jobin 
sarath thatavarthy, modified 4 Years ago.

RE: Unresolved requirement: Import-Package: com.liferay.portal.kernel.util;

New Member Posts: 5 Join Date: 12/7/17 Recent Posts
I did create the service builder project from the Liferay studio. But why does the pom.xml ship with the 2.0.0 for the release and waste my time. Honestly they must streamline their code builder something like https://start.spring.io/ or a more robust tool. I can see why AEM is a leader in the magic quadrant. 
Sanjeet Kumar, modified 4 Years ago.

RE: Unresolved requirement: Import-Package: com.liferay.portal.kernel.util;

New Member Post: 1 Join Date: 11/7/19 Recent Posts
I am still getting thsi error. 
Unresolved requirement: Import-Package: com.liferay.portal.kernel.portlet.bridges.mvc; version="[1.6.0,2.0.0)"_ [Sanitized].Even though i have made below changes in version as per Victor's suggestion.<dependency>
            <groupId>com.liferay.portal</groupId>
            <artifactId>com.liferay.portal.kernel</artifactId>
            <version>3.0.0</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.liferay.portal</groupId>
            <artifactId>com.liferay.util.taglib</artifactId>
            <version>3.0.0</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
thumbnail
Charalampos Chrysikopoulos, modified 4 Years ago.

RE: Unresolved requirement: Import-Package: com.liferay.portal.kernel.util;

Junior Member Posts: 79 Join Date: 12/9/11 Recent Posts
Hi, I have the same error, only with different versions, described here: https://liferay.dev/forums/-/message_boards/message/118040260
Changing the kernel version doesn't seem to resolve the problem. What causes this error on the runtime?
chinmay abhyankar, modified 4 Years ago.

RE: Unresolved requirement: Import-Package: com.liferay.portal.kernel.util;

New Member Post: 1 Join Date: 4/20/20 Recent Posts
Hi All , I am using Liferay 7.0.3 CE GA4 and my gradle version is 5.6 ,I created a service builder project did buildService and when deploying to tomcat it gives me error as follows: Unresolved requirement: Import-Package: com.liferay.portal.kernel.dao.db; version="[7.5.0,8.0.0)"_ [Sanitized]
        at org.eclipse.osgi.container.Module.start(Module.java:429)
        at org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:402)
        at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundle(DirectoryWatcher.java:1253)
        at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundles(DirectoryWatcher.java:1225)
        at org.apache.felix.fileinstall.internal.DirectoryWatcher.doProcess(DirectoryWatcher.java:512)
        at org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:361)
        at org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:312)
Can AnyBody please help
thumbnail
Olaf Kock, modified 4 Years ago.

RE: Unresolved requirement: Import-Package: com.liferay.portal.kernel.util;

Liferay Legend Posts: 6403 Join Date: 9/23/08 Recent Posts
chinmay abhyankar:

Hi All , I am using Liferay 7.0.3 CE GA4 and my gradle version is 5.6 ,I created a service builder project did buildService and when deploying to tomcat it gives me error as follows: Unresolved requirement: Import-Package: com.liferay.portal.kernel.dao.db; version="[7.5.0,8.0.0)"_
Upgrade to GA7 (or better, a newer version), then patch, then try again.
Alternatively: How do you build (e.g. what are the dependencies you declare)? This version resolution is done compiletime, but fails at runtime. If your build-environment points to a different version than your runtime environment, you'll run into this kind of mismatch.