Foros de discusión

Using custom service in OSGi module in Liferay 7 GA3

Alex Voronin, modificado hace 7 años.

Using custom service in OSGi module in Liferay 7 GA3

New Member Mensajes: 17 Fecha de incorporación: 7/02/13 Mensajes recientes
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 hace 7 años.

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

Liferay Legend Mensajes: 14916 Fecha de incorporación: 2/09/06 Mensajes recientes
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 hace 7 años.

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

New Member Mensajes: 17 Fecha de incorporación: 7/02/13 Mensajes recientes
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 hace 7 años.

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

Liferay Legend Mensajes: 14916 Fecha de incorporación: 2/09/06 Mensajes recientes
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 hace 7 años.

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

New Member Mensajes: 17 Fecha de incorporación: 7/02/13 Mensajes recientes
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 hace 7 años.

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

Liferay Legend Mensajes: 14916 Fecha de incorporación: 2/09/06 Mensajes recientes
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 hace 7 años.

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

New Member Mensajes: 17 Fecha de incorporación: 7/02/13 Mensajes recientes
I solved the problem. Thank you!
Thirumal Reddy, modificado hace 7 años.

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

Regular Member Mensajes: 216 Fecha de incorporación: 3/12/15 Mensajes recientes
Hi Alex Voronin,
How did you solved the problem.
could you please elaborate..

Thanks..