Fórum

Using custom service in OSGi module in Liferay 7 GA3

Alex Voronin, modificado 7 Anos atrás.

Using custom service in OSGi module in Liferay 7 GA3

New Member Postagens: 17 Data de Entrada: 07/02/13 Postagens Recentes
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, modificado 7 Anos atrás.

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

Liferay Legend Postagens: 14919 Data de Entrada: 02/09/06 Postagens Recentes
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, modificado 7 Anos atrás.

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

New Member Postagens: 17 Data de Entrada: 07/02/13 Postagens Recentes
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, modificado 7 Anos atrás.

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

Liferay Legend Postagens: 14919 Data de Entrada: 02/09/06 Postagens Recentes
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, modificado 7 Anos atrás.

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

New Member Postagens: 17 Data de Entrada: 07/02/13 Postagens Recentes
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, modificado 7 Anos atrás.

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

Liferay Legend Postagens: 14919 Data de Entrada: 02/09/06 Postagens Recentes
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, modificado 7 Anos atrás.

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

New Member Postagens: 17 Data de Entrada: 07/02/13 Postagens Recentes
I solved the problem. Thank you!
Thirumal Reddy, modificado 7 Anos atrás.

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

Regular Member Postagens: 216 Data de Entrada: 03/12/15 Postagens Recentes
Hi Alex Voronin,
How did you solved the problem.
could you please elaborate..

Thanks..