0
votes

Build.Gradle File :

dependencies {
    compileOnly group: "com.liferay", name: "com.liferay.asset.taglib", version: "4.0.15"
    compileOnly group: "com.liferay", name: "com.liferay.comment.taglib", version: "2.0.7"
    compileOnly group: "com.liferay", name: "com.liferay.frontend.taglib", version: "4.0.15"
    compileOnly group: "com.liferay", name: "com.liferay.frontend.taglib.dynamic.section", version: "2.0.1"
    compileOnly group: "com.liferay", name: "com.liferay.frontend.taglib.form.navigator", version: "3.0.5"
    compileOnly group: "com.liferay", name: "com.liferay.frontend.taglib.util", version: "2.0.2"
    compileOnly group: "com.liferay", name: "com.liferay.journal.taglib", version: "3.0.1"
    compileOnly group: "com.liferay", name: "com.liferay.layout.taglib", version: "4.0.8"
    compileOnly group: "com.liferay", name: "com.liferay.site.taglib", version: "2.0.1"
    compileOnly group: "com.liferay.portal", name: "com.liferay.portal.kernel", version: "4.0.0"
    compileOnly group: "com.liferay.portal", name: "com.liferay.util.taglib", version: "4.1.0"
    compileOnly group: "javax.portlet", name: "portlet-api", version: "3.0.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: "org.osgi.service.component.annotations", version: "1.3.0"

    cssBuilder group: "com.liferay", name: "com.liferay.css.builder", version: "3.0.2"
}

`Liferay server version : liferay-ce-portal-7.3.1-ga2 Liferay Developer Studio Version: 3.8.0.202002250521-ga1

When I am performing this step i.e. Control Panel > App manager > find my created portlet > activate, I am getting below error.Please help me to get out from this problem

Error Log :

2020-04-28 00:55:45.121 ERROR [http-nio-8080-exec-4][PortletServlet:119] javax.portlet.PortletException: org.osgi.framework.BundleException: Could not resolve module: MyFirstPortlet [2280]_  Unresolved requirement: Import-Package: com.liferay.portal.kernel.portlet.bridges.mvc; version="[2.0.0,3.0.0)"_ [Sanitized]
javax.portlet.PortletException: org.osgi.framework.BundleException: Could not resolve module: MyFirstPortlet [2280]_  Unresolved requirement: Import-Package: com.liferay.portal.kernel.portlet.bridges.mvc; version="[2.0.0,3.0.0)"_ [Sanitized]
    at com.liferay.portal.kernel.portlet.LiferayPortlet.callActionMethod(LiferayPortlet.java:192)
    at com.liferay.portal.kernel.portlet.bridges.mvc.MVCPortlet.callActionMethod(MVCPortlet.java:395)
    at com.liferay.portal.kernel.portlet.LiferayPortlet.processAction(LiferayPortlet.java:88)
    at com.liferay.portal.kernel.portlet.bridges.mvc.MVCPortlet.processAction(MVCPortlet.java:248)
1
Please post more info, e.g. a minimal reproducible example: You compile your portlet with a dependency that's not available at runtime, e.g. your development environment might be configured with a different version of Liferay Portal than your runtime environment.Olaf Kock
As you see: Your files don't show up in comments. Rather edit your question with additional information. You should give as much detail as you can in the question itself, to help us help you, and to help others who run into the same problem after yourself. Include not only your buildfiles, but also exact versions.Olaf Kock
I updated my questions with all possible details.Kindly tell me where is the problem exactlyJagriti Pandey

1 Answers

1
votes

The problem is in one of the dependencies' version that you have configured in build.gradle. What happens is that your build environment uses the versions declared in your build.gradle, but during runtime your module doesn't find compatible versions of the libraries it depends on. Thus it can't be deployed.

Assuming that you're working with Liferay Workspace (i.e. your portlet is in the subdirectory modules), the easiest way to work around it is to use its "target platform": Edit your Liferay workspace's gradle.properties (on top level) and make sure it contains a line denoting the version you're targeting:

liferay.workspace.target.platform.version = 7.3.1

Also, check the rest of the file, it points to a matching bundle and you should be consistent.

When you've done this, remove the version declarations from your build.gradle, as they'll be automatically taken from the matching runtime. Once you upgrade your runtime environment to the next GA release, you might need to upgrade the target version again.