Unresolved requirement for non-existing version

Tom Jacobs, modified 6 Years ago. New Member Posts: 12 Join Date: 3/11/19 Recent Posts
Hi,

I'm trying to work with the journalArticleLocalService in a custom module. For this I added a dependency to my build.gradle file:
compile group: 'com.liferay', name: 'com.liferay.journal.api', version: '4.4.0'

When I try to deploy this module, I'm getting an error:
org.osgi.framework.BundleException: Could not resolve module: content.manager [1098]_ Unresolved requirement: Import-Package: com.liferay.journal.service; version="[2.7.0,3.0.0)"_ [Sanitized]

So I go to mvnrepository and look for the correct dependency for com.liferay.journal.service: https://mvnrepository.com/artifact/com.liferay/com.liferay.journal.service

But there is no version between 2.7.0 and 3.0.0

What do I do now?
thumbnail
Christoph Rabel, modified 6 Years ago. Liferay Legend Posts: 1555 Join Date: 9/24/09 Recent Posts
It's a bit misleading.
Each jar file has a bundle version. That version is what you request using gradle/maven. But each package inside also has a version. And with Liferay, this version usually is different from the bundle version.
You probably need
compile group: 'com.liferay', name: 'com.liferay.journal.api', version: '3.0.0'
As a rule of thumb:
Look at the release time of your Liferay version. e.g. for 7.1 that was early July 2018. When a new version is released, Liferay bumps the bundle version. In maven repository you see that com.liferay.journal.api 3.0.0 was released in June 2018. That's probably the version you need. Using the lowest major version is usually fine in OSGI since it allows you to support the most installations.
Tom Jacobs, modified 6 Years ago. New Member Posts: 12 Join Date: 3/11/19 Recent Posts
Ok good to know! I'm working with Liferay 7.2, changed the com.liferay.journal.api version to 4.3.0 (for June 2019) and it works!Thank you!
thumbnail
Andrew Jardine, modified 6 Years ago. Liferay Legend Posts: 2416 Join Date: 12/22/10 Recent Posts
Hey Tom,Just to give you another reference (sometimes we don't have internet connections!) .. you can look it up in the bnd file with the module in the portal source of course, but there is also a file in the portal source called module.properties which contains a list that easy peasy to look up. The only thing you have to remember to do is subtract 1 point version off the value listed. So for example, I am looking at the file for 7.1 GA4 source and it has com.liferay.journal.api=3.5.8 .. so in my dependencies I would specify com.liferay.journal.api=3.5.7