Your Alfresco custom theme deployed as AMP or ZIP file

Alfresco ShareIn the various posts of this personal blog, the development of a custom theme of the Alfresco Share front end, is one of the most relevant and accessed. In a past tutorial, I share a simple way to develop your own theme for the Alfresco v4.2.c distribution.

In this post I would like to reach them same goal, but with an important improvement: the release of the theme in an AMP file or a ZIP file. All using an automatic solution based on a Java project managed by Eclipse IDE and Apache ANT.

Prerequisites

To understand how this solution works, you should have confidence with Eclipse IDE, Java projects, Git, Apache ANT and of course Alfresco (in particular with the AMP format). If you don’t have confidence with all of those things, this use case could be a way to improve your skills but, please, refer to the official documentations to learn how to use them before trying to test the content of this post.

Alle the source code described in this post has been tested in a Ubuntu 12.04 LTS operating system with Alfresco Community Edition v4.2.f on board, installed as bundle distribution. All the content should be valid for all the Alfresco distributions of the v4.2 family, both Community and Enterprise.

The git project my-first-alfresco-theme (on GitHub)

githubIn the repository below, you will find a Git repository called ‘my-first-alfresco-theme’, developing a copy of the ‘Green theme’ contained in the Alfresco vanilla installation. The developed theme is called ‘Alfresco themes – My first theme’.

The first task to do is to import the project from the repository, using Eclipse IDE at the link below:

https://github.com/fcorti/my-first-alfresco-theme.git

If you are not confident on how to import a project from Git, please refer to the web with a huge amount of tutorials or documentations. 😉

Once the project has been imported with success in your Eclipse IDE, in the ‘build’ folder you will find the two packages containing the theme: one in AMP format (‘alfrescoThemes_myFirstTheme.amp’) and one in ZIP format (‘alfrescoThemes_myFirstTheme.zip’).

If you want to re-build the packages after customizations, the build file (‘build.xml’) into the ANT view, is what you need for that purpose. If you are not confident on how to build a project with Apache ANT, please refer to the web with a huge amount of tutorials or documentations. 😉

How to deploy the theme in AMP format

The deployment using the AMP format should be preferred to the ZIP format. Below the step by step description of the task.

  • Open a terminal and go to the folder where Alfresco is installed (for example ‘/opt/alfresco-4.2.f’ on a linux platform).
  • Stop Alfresco (for example ‘./alfresco.sh stop’ on a linux platform).
  • Copy the AMP file from the ‘build’ folder of the project in the ‘amps-share’ folder (if you use an Alfresco bundle installation).
  • Go to the ‘bin’ subfolder and run ‘apply_amps’ script.
  • Go back to the Alfresco installation folder and start Alfresco again (for example ‘./alfresco.sh start’ on a linux platform).
  • Once Alfresco is started, open a browser with Alfresco Share, login as administrator and access to ‘Admin tools’ item in the menu.
  • In ‘Applications’, change the theme to your custom theme.

alfrescoCustomTheme1_en

That’s all!

How to deploy the theme in ZIP format

The deployment using the AMP format should be preferred to the ZIP format. Below the step by step description of the task.

  • Open a terminal and go to the folder where Alfresco is installed (for example ‘/opt/alfresco-4.2.f’ on a linux platform).
  • Stop Alfresco (for example ‘./alfresco.sh stop’ on a linux platform).
  • Unzip the ZIP file from the ‘build’ folder, directly in the Alfresco installation folder (you can merge the folders/subfolders/files to correctly install the theme).
  • Start Alfresco again (for example ‘./alfresco.sh start’ on a linux platform).
  • Once Alfresco is started, open a browser with Alfresco Share, login as administrator and access to ‘Admin tools’ item in the menu.
  • In ‘Applications’, change the theme to your custom theme, exactly in the same way is described in the picture before.

That’s all!

Francesco Corti

 

Liferay 6.1.1 CE GA2 IDE on JBoss 7 with Eclipse Juno… problems until now!

Eclipse_IconIn this post is shared the installation of Liferay 6.1.1 Community Edition GA2 IDE on Ubuntu 12.04 LTS 64bit with JBoss Application Server 7.1 Community Edition and PostgreSQL 8.4.15. The post is based on the installation tutorial described in the ‘Step by step installation of Liferay 6.1.1 CE GA2 on Ubuntu 12.04 LTS 64bit and JBoss 7… no bundle please!‘ and supposes you have the same environment installed and working in your system.

Unfortunately lot’s of problems are presents and documented here. Hope will be solved soon but until now this way of developing on Liferay with JBoss is not so easy yet.

As we like and prefer, the installation is a step by step list of commands and tasks… simpler to understand, to do and to test. Hope you’ll be agree.

Sources

In this paragraph are collected the used sources for the installation. I suggest to download and store them in a safe repository for future purposes (re-installation, maintainance, etc.).

  • Eclipse IDE for Java EE Developers – Juno release from Eclipse Downloads (‘eclipse-jee-juno-SR1-linux-gtk-x86_64.tar.gz’).
  • Plugin server-manager-web from Liferay Plugin 6.1 GA (‘server-manager-web-6.1.0.1-ce-ga1-….war’).
  • Liferay 6.1.1 GA2 on Tomcat Bundle from Liferay Portal Download (‘liferay-portal-tomcat-6.1.1-ce-ga2-….zip’).
  • Liferay SDK from Liferay Portal Download (‘liferay-plugins-sdk-6.1.1-ce-ga2-….zip’).

Eclipse Juno installation

Connect to the server (or the virtual machine like in our case) as ‘liferay’ user. We discourage the use of the root user for security reasons.

  • Open a terminal and execute:
cd /home/liferay/Desktop/
cp /mnt/.../eclipse-jee-juno-SR1-linux-gtk-x86_64.tar.gz .
tar zxvf eclipse-jee-juno-SR1-linux-gtk-x86_64.tar.gz
rm -rf eclipse-jee-juno-SR1-linux-gtk-x86_64.tar.gz
  • Let’s run eclipse and use it.
/home/liferay/Desktop/eclipse/eclipse &
  • In the menus bar: Help -> Check for update. Update, if requested, and restart.

Eclipse EGit installation

To have a professional version control of your source code you need a CVS, SVN, Git (or similar) module installed on Eclipse. Here we prefer EGit Eclipse that you can install as described below.

Liferay IDE installation

Liferay IDE, like all the Liferay suite, it’s very well documented here. Liferay IDE installation is documented here and it’s described below.

Add Liferay server as remote

Until now Liferay on JBoss is not supported using the Liferay IDE because only a Tomcat Server can be added to the list of Liferay servers. Reading around in the web and in the Liferay’s forum should be possibile to add a Liferay server as remote. We’ll see that it is possibile… but it doesn’t work properly. But let’s see how to do it.

  • Move the ‘server-manager-web-6.1.0.1-ce-ga1-….war’ file in ‘/opt/liferay/deploy’. This is a hot deploy and the file will be delete in few seconds.
  • To check the installation: open a browser and access to ‘http://localhost:8080/server-manager-web/status’ (login:test@liferay.com, password:test).
  • Below an example of correct result:
{"error":"","status":0,"output":""}

.

service liferay stop
nano /opt/liferay/jboss/standalone/configuration/standalone.xml

.

...
<subsystem xmlns="urn:jboss:domain:logging:1.1">
 ...
 <logger category="org.quartz"><level name="ERROR"/></logger>
 ...
  • Unzip the Liferay Tomcat bundle (‘liferay-portal-tomcat-6.1.1-ce-ga2-….zip’) in /opt/dummyLiferay
chown -R liferay:liferay /opt/dummyLiferay
/opt/dummyLiferay/tomcat-7.0.27/bin/startup.sh
  • Wait while liferay startup with success…
/opt/dummyLiferay/tomcat-7.0.27/bin/shutdown.sh
  • Unzip Liferay SDK (‘liferay-plugins-sdk-6.1.1-ce-ga2-….zip’) in /opt/liferay-plugins-sdk-6.1.1
chown -R liferay:liferay /opt/liferay-plugins-sdk-6.1.1
service liferay start
  • In Eclipse go to New Liferay SDK in the Liferay icon menu.
  • Location: ‘/opt/liferay-plugins-sdk-6.1.1’ and click Ok.
  • In Eclipse go to New Liferay Server in the Liferay icon menu.
  • Location: ‘/opt/liferay-plugins-sdk-6.1.1’ and click Ok.
  • Select ‘Remote Liferay Server’ -> Next
  • Select Liferay Bundle Type to Tomcat 7 and Liferay Bundle Directory set to ‘/opt/dummyLiferay/tomcat-7.0.27’ -> Next
  • Set Password to ‘test’ -> Validate connection -> Next -> Finish

In many tests, the INFO and WARN messages in the console are fast and so many. But restarting everything work… don’t know why.

My personal compliments… Liferay on JBoss and PostgreSQL is installed with success!

Unfortunately lot’s of problems are presents and documented here when you try to release something developed. Hope will be solved soon but until now this way of developing on Liferay with JBoss is not so easy yet.

Liferay 6.1.1 CE GA2 IDE on Tomcat 7 with Eclipse Juno

Eclipse_IconIn this post is shared the installation of Liferay 6.1.1 Community Edition GA2 IDE on Ubuntu 12.04 LTS 64bit with Apache Tomcat Application Server 7.0.32 and PostgreSQL 8.4.15. The post is based on the installation tutorial described in the ‘Step by step installation of Liferay 6.1.1 CE GA2 on Ubuntu 12.04 LTS 64bit and Tomcat 7… no bundle please!‘ and supposes you have the same environment installed and working in your system.

As we like and prefer, the installation is a step by step list of commands and tasks… simpler to understand, to do and to test. Hope you’ll be agree.

Sources

In this paragraph are collected the used sources for the installation. I suggest to download and store them in a safe repository for future purposes (re-installation, maintainance, etc.).

  • Eclipse IDE for Java EE Developers – Juno release from Eclipse Downloads (‘eclipse-jee-juno-SR1-linux-gtk-x86_64.tar.gz’).
  • Liferay 6.1.1 GA2 on Tomcat Bundle from Liferay Portal Download (‘liferay-portal-tomcat-6.1.1-ce-ga2-….zip’).
  • Liferay 6.1 JavaDoc from Liferay Portal Download (‘liferay-portal-doc-6.1.1-ce-ga2-….zip’).
  • Liferay 6.1 Source from Liferay Portal Download (‘liferay-portal-src-6.1.1-ce-ga2-….zip’).

Eclipse Juno installation

Connect to the server (or the virtual machine like in our case) as ‘liferay’ user. We discourage the use of the root user for security reasons.

  • Open a terminal and execute:
cd /home/liferay/Desktop/
cp /mnt/.../eclipse-jee-juno-SR1-linux-gtk-x86_64.tar.gz .
tar zxvf eclipse-jee-juno-SR1-linux-gtk-x86_64.tar.gz
rm -rf eclipse-jee-juno-SR1-linux-gtk-x86_64.tar.gz
  • Let’s run eclipse and use it.
/home/liferay/Desktop/eclipse/eclipse &
  • In the menus bar: Help -> Check for update. Update, if requested, and restart.

Eclipse EGit installation

To have a professional version control of your source code you need a CVS, SVN, Git (or similar) module installed on Eclipse. Here we prefer EGit Eclipse that you can install as described below.

Liferay IDE installation

Liferay IDE, like all the Liferay suite, it’s very well documented here. Liferay IDE installation is documented here and it’s described below.

Liferay SDK installation

service liferay stop.
  • Unzip Liferay SDK (‘liferay-plugins-sdk-6.1.1-ce-ga2-….zip’) in /opt/liferay-plugins-sdk-6.1.1
chown -R liferay:liferay /opt/liferay-plugins-sdk-6.1.1
  • In Eclipse go to New Liferay SDK in the Liferay icon menu.
  • Location: ‘/opt/liferay-plugins-sdk-6.1.1’ and click Ok.

Liferay JavaDoc and Source installation

  • Copy liferay-portal-doc-6.1.1-ce-ga2-….zip in ‘/opt/liferay’.
  • Copy liferay-portal-src-6.1.1-ce-ga2-….zip in ‘/opt/liferay’.
  • In Eclipse go to New Liferay Server in the Liferay icon menu.
  • Liferay v6.1 (on Tomcat 7) and then press Next.
  • Liferay Tomcat Directory:’/opt/liferay/tomcat’. Press Next.
  • ‘Browse Zip’ of Liferay Javadoc URL selecting ‘/opt/liferay/liferay-portal-doc-6.1.1-ce-ga2-….zip’.
  • ‘Browse Zip’ of Liferay Source URL selecting ‘/opt/liferay/liferay-portal-src-6.1.1-ce-ga2-….zip’.
  • Do not configure the bundle link (not done yet!).
  • Press Next then Finish.
  • In Eclipse go to Servers in the window and start the Liferay server.

Now you are ready to develop your first portlet.