Foros de discusión

How to create a generic OSGI module - Documentation.

Julian Pfeil, modificado hace 7 años.

How to create a generic OSGI module - Documentation.

Junior Member Mensajes: 72 Fecha de incorporación: 1/03/16 Mensajes recientes
I started reading the documentation section about customizing the product menu:
https://dev.liferay.com/develop/tutorials/-/knowledge_base/7-0/customizing-the-product-menu#adding-custom-panel-categories

There it says one should create a generic OSGI module e.g. with blade. But as far as i understood from the blade documnetation (Tooling->Blade CLI in this documentation) is used for creating liferay-specific modules.

So my question is: how to create a generic OSIG module using blade?

Also a suggestion to put the description of how to create a generic OSGI module via blade into the Tooling->Blade CLI section of the documentation, since the product customization documentation does reference it.

Kind Regards,
Julian
thumbnail
Cody Hoag, modificado hace 7 años.

RE: How to create a generic OSGI module - Documentation. (Respuesta)

Junior Member Mensajes: 70 Fecha de incorporación: 26/04/12 Mensajes recientes
Hi Julian,

We try to keep the documentation as tool-agnostic as possible, since so many developers prefer different tools. A generic OSGi module basically means you should create a project with your tool's build file (pom.xml, build.gradle, etc.) and a bnd.bnd file. Then the tutorial takes it from there by creating a package with a Java class. A generic Gradle project's anatomy would look something like this

- my-project
    - src
        - main
            - java
    - bnd.bnd
    - build.gradle


If you still want a generic OSGi module generated, this can be easily done by using any of the Blade CLI templates. For example, you could follow the Portlet Template tutorial to generate an OSGi module, and then delete the Portlet class generated. Then, voila! You have a "generic OSGi module".

Luckily, the tutorial you referenced has its own Blade CLI template: panelapp. You could run that template and get a head start for customizing the Product Menu. A tutorial for using that template in Blade CLI should be published today.

Let me know if you have any further questions!
Julian Pfeil, modificado hace 7 años.

RE: How to create a generic OSGI module - Documentation.

Junior Member Mensajes: 72 Fecha de incorporación: 1/03/16 Mensajes recientes
Cody Hoag:
Hi Julian,

We try to keep the documentation as tool-agnostic as possible, since so many developers prefer different tools. A generic OSGi module basically means you should create a project with your tool's build file (pom.xml, build.gradle, etc.) and a bnd.bnd file. Then the tutorial takes it from there by creating a package with a Java class. A generic Gradle project's anatomy would look something like this

- my-project
    - src
        - main
            - java
    - bnd.bnd
    - build.gradle


If you still want a generic OSGi module generated, this can be easily done by using any of the Blade CLI templates. For example, you could follow the Portlet Template tutorial to generate an OSGi module, and then delete the Portlet class generated. Then, voila! You have a "generic OSGi module".

Luckily, the tutorial you referenced has its own Blade CLI template: panelapp. You could run that template and get a head start for customizing the Product Menu. A tutorial for using that template in Blade CLI should be published today.

Let me know if you have any further questions!


Hey Cody Hoag,

thanks for the quick reply!

It would be nice to have the information you just wrote included in one of the earlier chapters (Fundamentals or Tooling), because it seems useful to me and is already concise enough to fit in an already-existing or it's own sub-chapter.
Also it helps liferay-dev-newcomers (like me) to understand the liferay development platform AND the documentation more easily, which makes it easier and more probable for new people to adopt liferay, because you don't have to search for basic but required (and referenced) information in the web. Of course, for further reading and extended information of external tooling there can always be links.

This is something i experience throughout most of this documentations chapters. But for this i'll post a new thread when i'm more used to liferay developing, so i can help with it.

Kind Regards,
Julian
thumbnail
Cody Hoag, modificado hace 7 años.

RE: How to create a generic OSGI module - Documentation.

Junior Member Mensajes: 70 Fecha de incorporación: 26/04/12 Mensajes recientes
Thanks for your feedback! We'll consider creating something like you suggested to help with those new to Liferay development.

Thanks again!
thumbnail
David H Nebinger, modificado hace 7 años.

RE: How to create a generic OSGI module - Documentation.

Liferay Legend Mensajes: 14915 Fecha de incorporación: 2/09/06 Mensajes recientes
Julian Pfeil:
I started reading the documentation section about customizing the product menu:
https://dev.liferay.com/develop/tutorials/-/knowledge_base/7-0/customizing-the-product-menu#adding-custom-panel-categories

There it says one should create a generic OSGI module e.g. with blade. But as far as i understood from the blade documnetation (Tooling->Blade CLI in this documentation) is used for creating liferay-specific modules.


Actually this has already been done. There's a new blade template, "api" which really just creates a blank bundle project. You get the bnd.bnd file and an effectively empty project.

Use:

blade create -t api [...] vanilla-bundle


to get your starting project.
Robert Meissner, modificado hace 7 años.

RE: How to create a generic OSGI module - Documentation.

Junior Member Mensajes: 76 Fecha de incorporación: 26/02/15 Mensajes recientes
I found the enroute tutorial and especially the best practices in developing microservices to be very helpful
http://enroute.osgi.org/tutorial_base/320-provider.html#how-does-it-work


Hope, this helps for you, too.