RE: javax.portlet version for Liferay 7.1

thumbnail
Aleksey Kashytsa, modified 7 Years ago. New Member Posts: 13 Join Date: 3/22/18 Recent Posts

  

Developing a portlet outside of Liferay workspace I use these plugins for build and manage version

        classpath group: "com.liferay", name: "com.liferay.gradle.plugins", version: "3.5.23"
        classpath group: "io.spring.gradle", name: "dependency-management-plugin", version: "1.0.6.RELEASE"

with respective BOMs

mavenBom "com.liferay:com.liferay.ce.portal.compile.only:7.1.0"
mavenBom "com.liferay:com.liferay.ce.portal.bom:7.1.0"

I get error:

error: cannot access RenderURL
        PortletURL redirectURL = liferayPortletResponse.createRenderURL();
                                                       ^
  class file for javax.portlet.RenderURL not found

   

Looking on Liferay 7.1.0 sources I found that many portlets uses

compileOnly group: "javax.portlet", name: "portlet-api", version: "3.0.0"

 

Modifing my dependencies to use "java.portlet:portlet-api:3.0.0"  I got

Unresolved requirement: Import-Package: javax.portlet; version="[3.0.0,4.0.0)"

and only aditing to bnd.bnd -contract: * get my portlet working.

 

Have I use compileOnly group: "javax.portlet", name: "portlet-api", version: "3.0.0" to compile for Liferay 7.1?

If it's so why BOM of Liferay 7.1 has portlet-api version 2.0 and not 3.0.0?

Thanks!

thumbnail
Minhchau Dang, modified 7 Years ago. Liferay Master Posts: 598 Join Date: 10/22/07 Recent Posts
Aleksey Kashytsa:
mavenBom "com.liferay:com.liferay.ce.portal.compile.only:7.1.0"
mavenBom "com.liferay:com.liferay.ce.portal.bom:7.1.0"

As mentioned in your other Maven BOM thread (reference), that BOM is invalid.

However, you'll run into the same versioning problem by switching to the newer proof of concept BOM, since com.liferay.portal:release.portal.bom.compile.only:7.1.0 lists the same javax.portlet:portlet-api version as as com.liferay:com.liferay.ce.portal.compile.only:7.1.0.

Aleksey Kashytsa:
If it's so why BOM of Liferay 7.1 has portlet-api version 2.0 and not 3.0.0?

My best guess is that, for compatibility reasons, Liferay claims to export javax.portlet (the package) version 2.0 in its system.packages.extra.bnd, even though its actual compile time dependency is version 3.0.1 of the portlet API, as listed in dependencies.properties.

As for why we aren't claiming to export version 3.0 of that package, it's a mix of the fact that Liferay won't finish implementing Portlet 3.0 until GA2 alongside some of the reasons listed LPS-81636. However, it's not clear to me if Liferay will also change the Export-Package versions once Portlet 3.0 is code-complete, given the desire to have backwards compatibility.