RE: Dependency Issue

thumbnail
Shiva Lingam K, modified 6 Years ago. New Member Posts: 18 Join Date: 5/9/18 Recent Posts
Hello everyone,

I want to use CalEvent class in Liferay 7.2 which is removed after Liferay 6.2. So, I have used 
          compileOnly  group: 'com.liferay.portal', name: 'portal-service', version: '6.2.5'  in build.gradle.After adding that CalEvent class is working but I am getting the below issue while deploying

org.osgi.framework.BundleException: Could not resolve module: ca.cityofkingston.hooks.action [1148]_  Unresolved requirement: Import-Package: com.liferay.portlet.calendar.model; version="[6.2.0,7.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:1264)
    at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundles(DirectoryWatcher.java:1237)
    at org.apache.felix.fileinstall.internal.DirectoryWatcher.doProcess(DirectoryWatcher.java:520)
    at org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:365)
    at org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:316)



So, after adding Include-Resource: @portal-service-6.2.5.jar in bnd.bnd file then I am getting the below error
[aQute.bnd.annotation.ProviderType annotation used in class com.liferay.counter.model.CounterModel. Bnd versioning annotations are deprecated as of Bnd 3.2 and support will be removed in Bnd 4.0. Please change to use OSGi versioning annotations., aQute.bnd.annotation. ]

FAILURE: Build failed with an exception.

* What went wrong:
Could not copy MANIFEST.MF to 'D:\Liferay_7.2Workspace\modules\kingston-liferay-hook\build\tmp\jar\MANIFEST.MF'.
> Build has errors


Can anyone resolve the solution ??
thumbnail
Andrew Jardine, modified 6 Years ago. Liferay Legend Posts: 2416 Join Date: 12/22/10 Recent Posts
Hi Shiva,

I have no real world experience with the calendar portlet before Liferay 7, but I think the CalEvent model object was moved/renamed to CalendarBooking starting in Liferay 7. 

I would recommend that you update your code that you are porting from 6.2 to reference the new 7.x model and that way you can reference the correct (OSGI based) classes and avoid those types of errors. Referecing that portal-service.jar could cause all sorts of problems for you in 7+ as a lot fo the services are still available in 7+ but under different packages. I think using that appraoch you'd end up in a really frustrating and confusing mess. 
thumbnail
Amos Fong, modified 6 Years ago. New Member Posts: 18 Join Date: 5/9/18 Recent Posts
Thank You, Andrew, your suggestion has worked.CalEvent model has changed to CalendarBooking.It is working fine nowemoticon​​​​​​​