留言板

Using custom service in OSGi module in Liferay 7 GA3

Alex Voronin,修改在7 年前。

Using custom service in OSGi module in Liferay 7 GA3

New Member 帖子: 17 加入日期: 13-2-7 最近的帖子
Hi, everyone!
I'm using Liferay 7 GA3.
I have a custom liferay portlet with a service. Now I'm trying to create a new OSGi module. In this module I want to use service from custom portlet. I tried options 1 and 2 from this article . But when I compiling my module with gradle, I've get an error: package com.customportlet.service does not exist. It seems to me, I need to specify some dependencies or path to my liferay folder, but I don't know how.
thumbnail
David H Nebinger,修改在7 年前。

RE: Using custom service in OSGi module in Liferay 7 GA3

Liferay Legend 帖子: 14919 加入日期: 06-9-2 最近的帖子
If you are using a LR workspace, then you use your "compile project(':modules:service')" sort of format.

If you are not using a workspace, then your other project needs to install the jar into your local repo or publish to a nexus-like system.

This will make the project available for compile-time usage which is where your compile failure is occurring.

The blog is for runtime dependencies (deployment failures), not compile time issues.
Alex Voronin,修改在7 年前。

RE: Using custom service in OSGi module in Liferay 7 GA3

New Member 帖子: 17 加入日期: 13-2-7 最近的帖子
Thanks for your reply.
I'm using LR workspace, but my custom portlet is not a module project, it is a plugin project. How do I connect it in this case?
thumbnail
David H Nebinger,修改在7 年前。

RE: Using custom service in OSGi module in Liferay 7 GA3

Liferay Legend 帖子: 14919 加入日期: 06-9-2 最近的帖子
Hmm, I don't know if that is really supported, but it is really not something that I have tried.

I would not recommending mixing legacy and module together though. If you're going to bite the bullet and start building modules, then build modules and discard the legacy api. After all it is really only there for backwards compatibility with your existing Liferay plugins but is not intended to be used for new development.
Alex Voronin,修改在7 年前。

RE: Using custom service in OSGi module in Liferay 7 GA3

New Member 帖子: 17 加入日期: 13-2-7 最近的帖子
I began to develop the modules, but I need the service of the old plugin portlet. I can try to move the service to the new module, but will all other plug-ins which are also using this service work correctly?
thumbnail
David H Nebinger,修改在7 年前。

RE: Using custom service in OSGi module in Liferay 7 GA3

Liferay Legend 帖子: 14919 加入日期: 06-9-2 最近的帖子
When you build the service in the new sdk you should get an api jar, but this is actually an osgi bundle that you can use in your regular modules.

The challenge of course is how you access the jar at compile time for the module build. It may be easier to install into your local repo and then reference as a regular dependency in your module.

The runtime dependency should not be an issue; the bundles will be deployed and available. You just need to figure out the compile time dependencies.
Alex Voronin,修改在7 年前。

RE: Using custom service in OSGi module in Liferay 7 GA3

New Member 帖子: 17 加入日期: 13-2-7 最近的帖子
I solved the problem. Thank you!
Thirumal Reddy,修改在7 年前。

RE: Using custom service in OSGi module in Liferay 7 GA3

Regular Member 帖子: 216 加入日期: 15-12-3 最近的帖子
Hi Alex Voronin,
How did you solved the problem.
could you please elaborate..

Thanks..