Difference between revisions of "Building your gCube Portlet in ETICS"
(19 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
− | + | <!-- CATEGORIES --> | |
− | + | [[Category:Developer's Guide]][[Category:TO_BE_REMOVED]] | |
+ | <!-- END CATEGORIES --> | ||
+ | This page provide a simple guide on how to build gCube portlets in ETICS including build scripts and creation of ETICS configurations. | ||
− | == build.xml == | + | '''INFO''': For each section, a ''special'' sub-section is provided to guide developers in porting old gridsphere portlets to new liferay-portlet format. |
+ | |||
+ | |||
+ | = Build Scripts = | ||
+ | In order to build a portlet (either in ETICS or in development machine), following two template files are provided (hosted in D4Science-II's svn repository): | ||
+ | * '''build.xml''': download from [[http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portal/portal-framework/MyGCubePortlet/build.xml here]] | ||
+ | * '''build.properties''': download from [[http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portal/portal-framework/MyGCubePortlet/build.properties here]] | ||
+ | |||
+ | |||
+ | These files must be copied in portlet's root directory and ''build.properites'' must be partially customized with actual values for the portlet (see below). | ||
+ | |||
+ | |||
+ | '''INFO''': Please consider those files as a template that can be adapted/modified/extended if a portlet has specific needs. | ||
+ | |||
+ | |||
+ | == build.xml details == | ||
Targets provided by build.xml are: | Targets provided by build.xml are: | ||
* '''setenv''': sets classpath. All other targets depend on it; | * '''setenv''': sets classpath. All other targets depend on it; | ||
Line 9: | Line 26: | ||
* '''war''': creates war package | * '''war''': creates war package | ||
* '''javadoc''': runs javadoc compiler | * '''javadoc''': runs javadoc compiler | ||
+ | * '''d4s-deploy''': used for automatic portlet's deploy in D4Science's infrastructure | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | == build.properties details == | |
+ | Following properties, at least, must be customized: for all portlets | ||
+ | * '''war.filename''': name given to the final ''war'' package. Note: without extension (e.g. "myportlet" instead of "myportlet.war") | ||
+ | * '''gwt-module''': name of GWT module to pass to the gwt compiler. If portlet does not use GWT, it will be ignored | ||
+ | * '''javadoc.doctitle''': title for documentation pages generated by javadoc compiler | ||
+ | * '''javadoc.windowtitle''': value for <title> tag of HTML pages generated by javadoc compiler | ||
− | = ETICS Configuration = | + | == <span style="color:red">Porting from old Gridsphere Portlet</span> == |
+ | ''build.xml'' and '' build.properties'' used in gridsphere portltes are incompatible with new build scritps for liferay portlets. Old build scripts must be replaced with new ones. | ||
+ | |||
+ | |||
+ | = Deploy Scripts = | ||
+ | In order to enable automatic deploy for D4Science portlets, following script must be included in each portlet. It will be included in portlet's servicearchive and executed at deploy-time. | ||
+ | |||
+ | |||
+ | Download '''installPortlet.sh''' from [[http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portal/portal-framework/MyGCubePortlet/installPortlet.sh here]] and copy it in portlet's root directory. | ||
+ | |||
+ | ''NOTE'': This script is very standard and should not be customized at all. | ||
+ | |||
+ | |||
+ | == <span style="color:red">Porting from old Gridsphere Portlet</span> == | ||
+ | Although ''installPortlet.sh'' script already exists in gridsphere portlets, it is considerably changed in liferay portlets, so the old ''installPortlet.sh'' must be updated with the new one. | ||
+ | |||
+ | |||
+ | = Portlet's ETICS Configuration = | ||
In this page a guide to create an ETICS configuration for a D4Science-II portlet is provided. | In this page a guide to create an ETICS configuration for a D4Science-II portlet is provided. | ||
+ | |||
== Build Commands == | == Build Commands == | ||
Build commands specification is quite straightforward: you can refer to following screenshot. | Build commands specification is quite straightforward: you can refer to following screenshot. | ||
− | [[Image:PortletBuildCommands.png]] | + | [[Image:PortletBuildCommands.png|frame|600px|center]] |
+ | |||
+ | |||
+ | '''clean:''' ant clean | ||
+ | |||
+ | '''compile:''' ant compile gwt-compile war | ||
+ | |||
+ | '''doc:''' ant javadoc | ||
+ | |||
+ | '''install:''' mkdir -p ${prefix}/lib; cp build/*.war ${prefix}/lib; cp -r doc/ ${prefix} | ||
+ | |||
+ | |||
== Dependencies == | == Dependencies == | ||
− | In order to simplify portlet's dependencies management a ''special'' component has been created: '''org.gcube.portal.portal-framework'''. | + | |
+ | In order to simplify portlet's dependencies management a ''special'' component has been created: '''org.gcube.portal.portal-framework'''. This component aims to: | ||
* decouple portlets from the specific portal implementation (e.g.: gridsphere, liferay,...); | * decouple portlets from the specific portal implementation (e.g.: gridsphere, liferay,...); | ||
− | + | * provide a common environment to compile portlets; | |
− | * provide | + | |
+ | '''All portlets should express a dependency on org.gcube.portal.portal-framework.''' | ||
− | |||
=== portal-framework details === | === portal-framework details === | ||
+ | |||
At the moment, '''org.gcube.portal.portal-framework''' provide portlets that express it as dependency with: | At the moment, '''org.gcube.portal.portal-framework''' provide portlets that express it as dependency with: | ||
− | * a | + | * a PORTAL_HOME env variable that point to actual location on filesystem of portal libraries; |
− | * a | + | * a GWT_HOME anv variable that point to actual location of gwt installation directory; |
− | * '''gwt''' | + | * gwt dependency; |
− | * ''' | + | * liferay dependency; |
− | * '''gcube- | + | |
+ | |||
+ | == <span style="color:red">Porting from old Gridsphere Portlet</span> == | ||
+ | If you are porting from an old Gridsphere portlet, required steps are: | ||
+ | * replace old ''build commands'' with new ones; | ||
+ | * remove following dependencies: tomcat, gridsphere, gwt-lib, gwt-runtime | ||
+ | * add org.gcube.portal.portal-framework dependency | ||
+ | |||
+ | |||
+ | = ServiceArchive's ETICS configuration = | ||
+ | |||
+ | |||
+ | == Build Commands == | ||
+ | |||
+ | [[Image:SABuildCommands.png|frame|600px|center]] | ||
+ | |||
+ | ''Please in following example replace QuickSearchPortlet and org.gcube.portlets-user.quick-search-portlet with actual portlet's name and component's name'' | ||
+ | |||
+ | * '''init''': mkdir -p ${prefix}/QuickSearchPortlet/lib; | ||
+ | * '''install''': cp ${org.gcube.portlets-user.quick-search-portlet.moduleDir}/etc/profile.xml ${org.gcube.portlets-user.quick-search-portlet.moduleDir}/README ${org.gcube.portlets-user.quick-search-portlet.moduleDir}/LICENSE ${org.gcube.portlets-user.quick-search-portlet.moduleDir}/INSTALL ${org.gcube.portlets-user.quick-search-portlet.moduleDir}/CHANGELOG ${org.gcube.portlets-user.quick-search-portlet.moduleDir}/MAINTAINERS ${prefix}; cp ${org.gcube.portlets-user.quick-search-portlet.moduleDir}/installPortlet.sh ${org.gcube.portlets-user.quick-search-portlet.moduleDir}/build.xml ${org.gcube.portlets-user.quick-search-portlet.moduleDir}/build.properties ${prefix}/QuickSearchPortlet; cp `find ${org.gcube.portlets-user.quick-search-portlet.moduleDir} -name "*.war" -print` ${prefix}/QuickSearchPortlet/lib; echo ${org.gcube.portlets-user.quick-search-portlet.vcsroot}/${org.gcube.portlets-user.quick-search-portlet.tag} > ${prefix}/QuickSearchPortlet/svnpath.txt; | ||
+ | |||
+ | == Dependencies == | ||
+ | Servicearchive's configuration must express a dependency on portlet's component | ||
+ | |||
+ | |||
+ | == <span style="color:red">Porting from old Gridsphere Portlet</span> == | ||
+ | In case you are porting an old gridsphere portlet you have to slightly modify your profile.xml to successfully build portlet's servicearchive since install.xml script has been renamed in build.xml. | ||
+ | In '''/etc/profile.xml''', replace: | ||
+ | <pre> | ||
+ | <Files> | ||
+ | <File>lib/myportlet.war</File> | ||
+ | <File>install.xml</File> | ||
+ | <File>build.properties</File> | ||
+ | </Files> | ||
+ | </pre> | ||
+ | with: | ||
+ | <pre> | ||
+ | <Files> | ||
+ | <File>lib/myportlet.war</File> | ||
+ | <File>build.xml</File> | ||
+ | <File>build.properties</File> | ||
+ | </Files> | ||
+ | </pre> |
Latest revision as of 17:51, 6 July 2016
This page provide a simple guide on how to build gCube portlets in ETICS including build scripts and creation of ETICS configurations.
INFO: For each section, a special sub-section is provided to guide developers in porting old gridsphere portlets to new liferay-portlet format.
Contents
Build Scripts
In order to build a portlet (either in ETICS or in development machine), following two template files are provided (hosted in D4Science-II's svn repository):
These files must be copied in portlet's root directory and build.properites must be partially customized with actual values for the portlet (see below).
INFO: Please consider those files as a template that can be adapted/modified/extended if a portlet has specific needs.
build.xml details
Targets provided by build.xml are:
- setenv: sets classpath. All other targets depend on it;
- compile: compiles java soruces
- gwt-compile: runs gwt compiler
- war: creates war package
- javadoc: runs javadoc compiler
- d4s-deploy: used for automatic portlet's deploy in D4Science's infrastructure
build.properties details
Following properties, at least, must be customized: for all portlets
- war.filename: name given to the final war package. Note: without extension (e.g. "myportlet" instead of "myportlet.war")
- gwt-module: name of GWT module to pass to the gwt compiler. If portlet does not use GWT, it will be ignored
- javadoc.doctitle: title for documentation pages generated by javadoc compiler
- javadoc.windowtitle: value for <title> tag of HTML pages generated by javadoc compiler
Porting from old Gridsphere Portlet
build.xml and build.properties used in gridsphere portltes are incompatible with new build scritps for liferay portlets. Old build scripts must be replaced with new ones.
Deploy Scripts
In order to enable automatic deploy for D4Science portlets, following script must be included in each portlet. It will be included in portlet's servicearchive and executed at deploy-time.
Download installPortlet.sh from [here] and copy it in portlet's root directory.
NOTE: This script is very standard and should not be customized at all.
Porting from old Gridsphere Portlet
Although installPortlet.sh script already exists in gridsphere portlets, it is considerably changed in liferay portlets, so the old installPortlet.sh must be updated with the new one.
Portlet's ETICS Configuration
In this page a guide to create an ETICS configuration for a D4Science-II portlet is provided.
Build Commands
Build commands specification is quite straightforward: you can refer to following screenshot.
clean: ant clean
compile: ant compile gwt-compile war
doc: ant javadoc
install: mkdir -p ${prefix}/lib; cp build/*.war ${prefix}/lib; cp -r doc/ ${prefix}
Dependencies
In order to simplify portlet's dependencies management a special component has been created: org.gcube.portal.portal-framework. This component aims to:
- decouple portlets from the specific portal implementation (e.g.: gridsphere, liferay,...);
- provide a common environment to compile portlets;
All portlets should express a dependency on org.gcube.portal.portal-framework.
portal-framework details
At the moment, org.gcube.portal.portal-framework provide portlets that express it as dependency with:
- a PORTAL_HOME env variable that point to actual location on filesystem of portal libraries;
- a GWT_HOME anv variable that point to actual location of gwt installation directory;
- gwt dependency;
- liferay dependency;
Porting from old Gridsphere Portlet
If you are porting from an old Gridsphere portlet, required steps are:
- replace old build commands with new ones;
- remove following dependencies: tomcat, gridsphere, gwt-lib, gwt-runtime
- add org.gcube.portal.portal-framework dependency
ServiceArchive's ETICS configuration
Build Commands
Please in following example replace QuickSearchPortlet and org.gcube.portlets-user.quick-search-portlet with actual portlet's name and component's name
- init: mkdir -p ${prefix}/QuickSearchPortlet/lib;
- install: cp ${org.gcube.portlets-user.quick-search-portlet.moduleDir}/etc/profile.xml ${org.gcube.portlets-user.quick-search-portlet.moduleDir}/README ${org.gcube.portlets-user.quick-search-portlet.moduleDir}/LICENSE ${org.gcube.portlets-user.quick-search-portlet.moduleDir}/INSTALL ${org.gcube.portlets-user.quick-search-portlet.moduleDir}/CHANGELOG ${org.gcube.portlets-user.quick-search-portlet.moduleDir}/MAINTAINERS ${prefix}; cp ${org.gcube.portlets-user.quick-search-portlet.moduleDir}/installPortlet.sh ${org.gcube.portlets-user.quick-search-portlet.moduleDir}/build.xml ${org.gcube.portlets-user.quick-search-portlet.moduleDir}/build.properties ${prefix}/QuickSearchPortlet; cp `find ${org.gcube.portlets-user.quick-search-portlet.moduleDir} -name "*.war" -print` ${prefix}/QuickSearchPortlet/lib; echo ${org.gcube.portlets-user.quick-search-portlet.vcsroot}/${org.gcube.portlets-user.quick-search-portlet.tag} > ${prefix}/QuickSearchPortlet/svnpath.txt;
Dependencies
Servicearchive's configuration must express a dependency on portlet's component
Porting from old Gridsphere Portlet
In case you are porting an old gridsphere portlet you have to slightly modify your profile.xml to successfully build portlet's servicearchive since install.xml script has been renamed in build.xml. In /etc/profile.xml, replace:
<Files> <File>lib/myportlet.war</File> <File>install.xml</File> <File>build.properties</File> </Files>
with:
<Files> <File>lib/myportlet.war</File> <File>build.xml</File> <File>build.properties</File> </Files>