Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Cosco SCJ
Duplicate Liferay portlet and modifiy java files?
October 19, 2012 4:43 AM
Answer

Cosco SCJ

Rank: New Member

Posts: 20

Join Date: August 22, 2012

Recent Posts

Is possible to duplicate Liferay portlet and modifiy java files?

For example i want to duplicate "asset publisher" but with name "Custom Asset Publisher" and add my own app.
Where i find the source java files or the project Asset publisher???


Thansk a lot.
Apoorva Prakash
RE: Duplicate Liferay portlet and modifiy java files?
October 19, 2012 5:42 AM
Answer

Apoorva Prakash

Rank: Liferay Master

Posts: 659

Join Date: June 15, 2010

Recent Posts

Hey Cosco,

You need to see development using Hooks. See this link.

Even you want to create a new portlet using LIferay code, you can download the source code from here.

Hope this will help.

Thanks and Regards,
Apoorva Prakash
Hitoshi Ozawa
RE: Duplicate Liferay portlet and modifiy java files?
October 19, 2012 6:46 AM
Answer

Hitoshi Ozawa

Rank: Liferay Legend

Posts: 7949

Join Date: March 23, 2010

Recent Posts

Asset Publisher portlet is integrated with liferay so it'll take some work to create a new portlet project from the current code.

BTW, is the any reason to duplicate liferay's code instead of overriding the current java classes to customize it? Liferay's java codes can be customized by using hooks and ext plugin. If you still decide to copy the codes, you'll be bound to the GPL and make the source code available.

http://www.liferay.com/documentation/liferay-portal/6.1/development/-/ai/extending-and-customizing-lifer-3
Stian Sigvartsen
RE: Duplicate Liferay portlet and modifiy java files?
October 21, 2012 3:54 AM
Answer

Stian Sigvartsen

Rank: Regular Member

Posts: 103

Join Date: August 27, 2010

Recent Posts

You should check out Wiki page called "Plugin to extend a plugin": http://www.liferay.com/community/wiki/-/wiki/Main/Plugin+to+extend+a+plugin

Though I have not tried this myself, but it sounds like it works similarly to how theme plug-ins work in that you override specific resources from a parent plug-in (parent theme). In this case you can even override .java files that you want to modify the behaviour for. At build time a snapshot of the original plug-in is taken, this has the effect of extending its functionality with minimal work. Just beware of the dependencies on service layer. So make sure you rebuild you plug-in so changes to the service layer are flagged up as compile errors.

-Stian
Hitoshi Ozawa
RE: Duplicate Liferay portlet and modifiy java files?
October 21, 2012 6:12 AM
Answer

Hitoshi Ozawa

Rank: Liferay Legend

Posts: 7949

Join Date: March 23, 2010

Recent Posts

I think that's for extending non-bundled plugins. Asset Publisher is prebundled in liferay.

I think that feature has been made public because some portlets have been made available from the Marketplace instead of being prebundled.
When using this feature, there's one warning - license. It's merging source code so the source code of the portlet will be included implying if the original portlet's license is LGPL, you'll be bound to provide source code of the portlet you've created.