Message Boards

Dependency conundrum in 7.3.2

thumbnail
Pete Helgren, modified 3 Years ago.

Dependency conundrum in 7.3.2

Regular Member Posts: 225 Join Date: 4/7/11 Recent Posts
I have a couple of things that need fixing so I have been installing the latest and greatest as they become available.  The most functional version of LR CE seems to be 7.3.0 ga1.  I installed 7.3.2 CE ga3 to check it out and when I deployed the osgi modules I had been deploying to 7.3.0 to 7.3.2 I got the following error:

Unresolved requirement: Import-Package: com.liferay.portal.kernel.model; version="[4.1.0,5.0.0)"_ [Sanitized]

It's not unusual to have a change in the kernel,  build.gradle has this:
    compileOnly group: "com.liferay.portal", name: "com.liferay.portal.kernel", version: "5.4.0"
So I am a little confused and I probably don't understand what the Version annotation entries in the build.gradle actually means.  I *thought* it pointed to the version needed for deployment and roughly pointed to the version that corresponded to the version of Liferay that was running upon deployment.  But the error I see above, which doesn't occur when I deploy to 7.3.0 seems to point to a "lower" version of the kernel jar than was needed for 7.3.0 .  Going to 7.3.2 I would have expected a need for a *higher* version of the kernel jar for 7.3.2 than 7.3.0.  Since error points (I think) to a kernel version somewhere between 4.10 and 5.0.0 I tried:    compileOnly group: "com.liferay.portal", name: "com.liferay.portal.kernel", version: "4.57.1"
Then I get the error: Unresolved requirement: Import-Package: com.liferay.portal.kernel.annotation; version="[6.3.0,7.0.0)"Different package and a higher version (which I would expect).   But, clearly, I am clueless about what version to use for each version of LR CE I will deploy to.  Is there some place where I can see what the gradle build versions should be for each version of Liferay, or am I just heading down the wrong path here.....?
thumbnail
Olaf Kock, modified 3 Years ago.

RE: Dependency conundrum in 7.3.2

Liferay Legend Posts: 6403 Join Date: 9/23/08 Recent Posts
Pete Helgren:

I have a couple of things that need fixing so I have been installing the latest and greatest as they become available.  The most functional version of LR CE seems to be 7.3.0 ga1.  I installed 7.3.2 CE ga3 to check it out and when I deployed the osgi modules I had been deploying to 7.3.0 to 7.3.2 I got the following error:
...

What confused me a lot in the beginning is the difference between a bundle's version and a package's version:
 compileOnly group: "com.liferay.portal", name: "com.liferay.portal.kernel", version: "5.4.0"
denotes the version of the bundle,
Unresolved requirement: Import-Package: com.liferay.portal.kernel.model; version="[4.1.0,5.0.0)"_ [Sanitized]
denotes the version of the package, within the bundle.
And yes, you might get major upgrades between the different GAs that force recompile. I'd hope that they're rare, but as they're rolling releases that bring new features, odds are that there might be one or the other invasive change - especially in kernel, that everyone depends on - between GA releases.
thumbnail
Pete Helgren, modified 3 Years ago.

RE: Dependency conundrum in 7.3.2

Regular Member Posts: 225 Join Date: 4/7/11 Recent Posts
Thanks.  So, how do you sort that out?  As far as I know nothing changed except the version of LR CE that I am deploying to: 7.3.2 vs 7.3.0  So where do I find the correct incantation that will allow the SB module to deploy?  IOW how can I accommodate the bundle AND the package requirements or where do I find what the needed changes will be to successfully deploy to 7.3.2 .  Even if I create a new SB module, the build.gradle ends up with this:

    compileOnly group: "com.liferay", name: "com.liferay.petra.io", version: "4.0.2"
    compileOnly group: "com.liferay", name: "com.liferay.petra.lang", version: "4.0.1"
    compileOnly group: "com.liferay", name: "com.liferay.petra.string", version: "4.0.1"
    compileOnly group: "com.liferay", name: "com.liferay.portal.aop.api", version: "2.0.0"
    compileOnly group: "com.liferay.portal", name: "com.liferay.portal.kernel", version: "5.4.0"
    compileOnly group: "org.osgi", name: "org.osgi.annotation.versioning", version: "1.1.0"
    compileOnly group: "org.osgi", name: "org.osgi.core", version: "6.0.0"
    compileOnly group: "org.osgi", name: "org.osgi.service.component.annotations", version: "1.3.0"

Which matches my other SB modules created for 7.3.  I cannot deploy to 7.3.2 with those entries.  Can't seem to find an example of entries that will satisfy the requirements
thumbnail
Christoph Rabel, modified 3 Years ago.

RE: Dependency conundrum in 7.3.2

Liferay Legend Posts: 1554 Join Date: 9/24/09 Recent Posts
You probably need to create a new workspace.
When I create a new service builder module, the service build.gradle dependencies look this way to me:
 
     compileOnly group: "com.liferay", name: "com.liferay.petra.io"
    compileOnly group: "com.liferay", name: "com.liferay.petra.lang"
    compileOnly group: "com.liferay", name: "com.liferay.petra.sql.dsl.api"
    compileOnly group: "com.liferay", name: "com.liferay.petra.string"
    compileOnly group: "com.liferay", name: "com.liferay.portal.aop.api"
    compileOnly group: "com.liferay.portal", name: "com.liferay.portal.kernel"
    compileOnly group: "org.osgi", name: "org.osgi.annotation.versioning"
    compileOnly group: "org.osgi", name: "org.osgi.core"
    compileOnly group: "org.osgi", name: "org.osgi.service.component.annotations"

I have used blade to create a module:
blade create -t service-builder -v 7.3.2 test
Note: This only builds inside of a 7.3.2 workspace, the feature was added in 7.3.1. Once you have upgraded to this workspace environment you should be only required to change the workspace version.
https://liferay.dev/blogs/-/blogs/liferay-portal-7-3-ce-ga2-release
thumbnail
Pete Helgren, modified 3 Years ago.

RE: Dependency conundrum in 7.3.2

Regular Member Posts: 225 Join Date: 4/7/11 Recent Posts
Thanks.  I read through the blog reference a couple of times and then just decided to try replacing my LR dependencies in build.gradle with 
compileOnly group: "com.liferay.portal", name: "release.portal.api", version: "7.3.2-ga3"
for both the api and service modules and it seems to work.  So, thanks for that tip