Liferay new portlet vs plugin project difference - java

I'm using Eclipse and have the Liferay plugin installed and trying to create a new portlet. I want the Liferay IDE to pre-generate as much code as possible
Does anyone know what the main differences are between creating a new Liferay Portlet and a Liferay Plugin Project?

Liferay Plugin Project allows you to create a project (of type portlet, theme, hook etc..), with all dependencies and settings that you need to start coding (or almost).
Liferay portlet adds to one of your plugin projects of type portlet a class (the portlet class) and optionally a JSP. But you have to tell the portlet how use this class and jsp, and probably many other missing settings.
I suggest you always use the Liferay Plugin Project, its simpler and fast.

I'd rather use a different explanation than Marco:
A plugin project is what you add to the IDE - This is where your actual plugins live. Eclipse organizes around projects, and the projects are what makes up a plugin for Liferay. As the IDE interprets different kinds of projects in a different way (e.g. standalone Java Applications vs. "Dynamic Web projects" etc), a "Portlet Project" or "Theme Project" just adds to this list.
Once you have a plugin project (of type "Portlet") you can add as many portlets to it as you like. Thus, if you're developing portlets, you'll always have a minimum of one portlet plugin. This portlet plugin can hold any number of portlets.
You'll always deploy the whole plugin to Liferay - this fact might influence which portlets you want to group into a single plugin.

Related

Liferay Maven Service Builder Portlet(Developer Studio)

I am new in Liferay platform. I am trying to implement CRUD in Liferay using portlet. I am using liferay 6.2 and IDE as a developer studio.
I am creating project with below values (In Image) in developer studio.
When I am creating project in Developer studio I am getting 3 project in my Liferay project explorer which are shown in below image.
So my question is that why its three project are created when I only want to create one service builder portlet. What are the use of that?
Anyone can help?
So this is what Liferay with Maven does:
It creates a Parent Project (BookServicePortlet). Liferay assumes, if you want to build a service layer, you also will implement a portlet where you access the Services generated. So that's why Liferay-Maven is creating 2 SubProjects in your parent project. One for the service, and one for Web-Tier. This is done, so that you can distribute your service layer to other portlets without distributing all your front-end code. If you don't have a front-end (and I doubt that ;) ) you could just leave all blank in BookServicePortlet-portlet.

Eclipse RCP avoid singletons

What is the simplest way to have some sort of DI in RCP application?
I need to register dependencies and use them in different parts of application: wizards, dialogs, properties pages, etc.
What I have: a product with bunch of plugins.
What I need: at start of Eclipse RCP product I need to read some files, keep this data in memory and make it accesible to different UI elements(among different plugins) without using of singletons.
I cant pass this data in constructors when creating consumers, because consumers are UI elements which often created by RCP platform and I dont have direct access for their creation.
Eclipse 4.3 supports DI. This works best for a RCP created as a pure Eclipse 4 application which does not use Eclipse 3 compatibility code ('e4' mode). Objects which are defined in the new application model are created using DI, but it is also possible to create other objects (dialogs for example) using injection.
For an introduction to Eclipse 4 RCP see http://www.vogella.com/articles/EclipseRCP/article.html
For an Eclipse 3 application a part can get the Eclipse Context needed for injection using
IWorkbenchPartSite site = part.getSite();
IEclipseContext parentContext = (IEclipseContext) site.getService(IEclipseContext.class);
Use org.eclipse.e4.core.contexts.ContextInjectionFactory for injection.
Or, if you are still using an Eclipse 3 application, you can use the Eclipse Plugin Registry to define extension points and extensions. This also amounts to Dependency Injection, without the injection :-)

Pre-Configured Java Web Application Project

Everytime when I create a new java web project, I have to configure and add many folders and property files for primefaces, hibernate, jsf, ldap, tomcat etc.
It wastes all my time. I find a solution for this, but it is not a generic solution.
My solution is that, I created a web project and configure all props and folders but not develop any code. It was an configured empty project. I mean it was my custom template project.
When I want to create a new web project, I always have to import this configured project and rename it. It's not a good way I think.
So, In the project creation tab, how can I add my custom project to creation wizard or how can I create my custom project in the beginning.
Is there any plugin or tool to create pre-configured template web project ?
Is there any tutorial to develop an eclipse plugin to do this ?
Thanks for your interest.
You probably need e.g. maven archetype that would generate such a project.
Alternatively you can use Spring Tool Suite, it has some predefined templates.
If you want to create plugin by yourself you can read more about Creating Eclipse Wizards (by Lars Vogel). But this is not so trivial (may need some work to make it work perfectly). Generally whole Lars Vogel's site is about creating Eclipse plugins.

Netbeans (7.3) - how to create a 'Java Web app' and HTML/JavaScript 'HTML 5 Application' in one project?

I want to create a new Netbeans 7.3 project that will be based on the 'HTML web-application' project type, but it will also need to communicate to a server, so I want to add 'Java Web support', but they are listed as two separate project types.
How can I create a Java web app and add the HTML 5 support into it? What are the steps required to create the 'merged' project types?
Apparently it's not tightly integrated in Netbeans yet, but I was able to do it by creating the two separate projects and then going in to the Web Application Project-Properties and adding an entry in the 'packaging' tab (see screenshot).

Can I package multiple Liferay portlets and a themes in a WAR file?

I can easily create Liferay portlets and themes individually using the Liferay plugin SDK. I have managed to combine multiple portlets into one WAR file which has been pretty convenient for deployment at client sites.
I have also created multiple themes for my Liferay installation and I was wondering if it's possible to combine all the portlets(5) and themes(2) ( perhaps hooks etc ) into one WAR file?
I dont think theme and portlets can be packaged together and it shouldnt be packaged together for better maintenance.
You can always package portlet and hook together in a single plugin project. I normally do it if the functionality in hook is tied with the portlet, otherwise I keep it separate.

Categories