Working with Liferay 6.2+ and 7

Concurrently... tips and settings

Working with Liferay 6.2 and 7.0.0-m4

I've been recently working on stabilizing my themes for Liferay 7. Looking at what will change and making adjustments for the products so they are ready for market the moment that Liferay 7 is released (late summer?).

This effort has made me more aware that most people or companies that develop the themes aren't thinking of the pain or pleasure that a new release of Liferay Portal will bring. Here are some tips and settings that I'm using to develop and test themes on Liferay 6.2 and 7 concurrently.

Number #1: Liferay Maven Plugin

This would be the official "other way" of building components for Liferay. In my experience, using the liferay maven plugin permits your project to adapt to enterprise level software tools quicker than the ant based Liferay SDK. Both are great for building liferay components, but maven can do so much more via off-the-shelf plugins like release software to nexus, minify css and javascript, deploy software to liferay, execute tests and so on...

Using the liferay maven plugin is quite simple. Simply make sure maven is on your path and then bootstrap a project by typing in the following:
># mvn archetype:generate

If you don't get results - you might be having a problem with your internet connection and/or your corporate proxy. Filter the results with liferay and you see 13 liferay plugin archetypes to choose from. By following the archetype wizard to its end, your new plugin is being bootstrapped to use the liferay maven plugin.

A good way around your corporate proxy is to save the latest archetype catalog to your $HOME/.m2/archetype-catalog.xml directory then use it locally.

># cd $HOME/.m2
># wget https://repo1.maven.org/maven2/archetype-catalog.xml
(NOTE: if that in not stalled use curl)
># curl -o archetype-catalog.xml https://repo1.maven.org/maven2/archetype-catalog.xml

Then when wanting to use the maven liferay plugin - execute the following command to get started:

># mvn archetype:generate -DarchetypeCatalog=local

Number #2: Maven Profiles

<settings
  xmlns="http://maven.apache.org/SETTINGS/1.0.0"              
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"              
  xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0                      
  http://maven.apache.org/xsd/settings-1.0.0.xsd">   
<profiles>
   <profile>
    <id>liferay-tomcat-62-ce</id>
    <properties>
        <tomcat.home>/Users/ben/Servers/Liferay/6.2-ce-ga3/tomcat-7.0.42</tomcat.home>
        <liferay.maven.plugin.version>6.2.10.10</liferay.maven.plugin.version>
        <liferay.version>6.2.10.10</liferay.version>
        <liferay.auto.deploy.dir>/Users/ben/Servers/Liferay/6.2-ce-ga3/deploy</liferay.auto.deploy.dir>
        <liferay.app.server.deploy.dir>${tomcat.home}/webapps</liferay.app.server.deploy.dir>
        <liferay.app.server.lib.global.dir>${tomcat.home}/lib/ext</liferay.app.server.lib.global.dir>
        <liferay.app.server.portal.dir>${tomcat.home}/webapps/ROOT</liferay.app.server.portal.dir>
    </properties>
</profile>
<profile>
    <id>liferay-tomcat-62-ee</id>
    <properties>
        <tomcat.home>/Users/ben/Servers/Liferay/6.2-ee-sp9/tomcat-7.0.42</tomcat.home>
        <liferay.maven.plugin.version>6.2.10.10</liferay.maven.plugin.version>
        <liferay.version>6.2.10.10</liferay.version>
        <liferay.auto.deploy.dir>/Users/ben/Servers/Liferay/6.2-ee-sp9/deploy</liferay.auto.deploy.dir>
       <liferay.app.server.deploy.dir>${tomcat.home}/webapps</liferay.app.server.deploy.dir>
       <liferay.app.server.lib.global.dir>${tomcat.home}/lib/ext</liferay.app.server.lib.global.dir>
      <liferay.app.server.portal.dir>${tomcat.home}/webapps/ROOT</liferay.app.server.portal.dir>
    </properties>
</profile>
<profile>
    <id>liferay-tomcat-7m4</id>
    <properties>
        <tomcat.home>/Users/ben/Projects/liferay7/bundles/tomcat-7.0.42</tomcat.home>
        <liferay.maven.plugin.version>7.0.0-m2</liferay.maven.plugin.version>
        <liferay.version>7.0.0-m4</liferay.version>    
  <liferay.auto.deploy.dir>/Users/ben/Projects/liferay7/bundles/deploy</liferay.auto.deploy.dir>
  
<liferay.app.server.deploy.dir>${tomcat.home}/webapps</liferay.app.server.deploy.dir>
<liferay.app.server.lib.global.dir>${tomcat.home}/lib/ext</liferay.app.server.lib.global.dir>     
<liferay.app.server.portal.dir>${tomcat.home}/webapps/ROOT</liferay.app.server.portal.dir>
    </properties>
    <repositories>
        <repository>
            <id>liferay</id>
            <url>https://repository.liferay.com/nexus/content/repositories/liferay-previews</url>
            <releases><enabled>true</enabled></releases>
            <snapshots><enabled>true</enabled></snapshots>
        </repository>
      </repositories>
    </profile> 
  </profiles>
  <activeProfiles>
    <activeProfile>liferay-tomcat-7m4</activeProfile>
  </activeProfiles>
</settings>

Target your build using a particular profile by executing:
># mvn clean package liferay:deploy -P liferay-tomcat-7m4

Liferay 7.0.0 m4

be prepared

Lets face it, not everyone gets to use the latest JDK; coolest java libraries; or NoSQL databases.  But, if they really want to use them later in their career, they go home and study.  Thats what this blog entry is all about.  Welcome to the upgraded JavaBlog.com using Liferay 7.0.0 m4.

NoSQL: not exactly but a fun, non-relational, horizontally scalable all the same database Elastic Search to go along with a good old MySQL.
Latest JDK: not exactly but its just around the corner (not JDK 8_20 instead JDK 7_75; but I tried!)
Coolest Libraries: yes, everything is upgraded compared to 6.1.30 which I'm using at work

There is this little menu that pops up when I pause or highlight some text while writing this blog.  Apparently thats the new AlloyUI 4 editor that I read about today.  After a longer pause... I see the elasticsearch logs in the background saving automatically (could have used that 20-years ago...).

I'm building apps for 6.2.  My first one was officially released on Tuesday: A13 Responsive ThemeStack in the Liferay Marketplace.  I tweeted for the first time this week too.  Now I got that little bird in my "inline editor window" to share my links with my followers.  Maybe in a while.

Until then - I will be developing apps targeting both Liferay 6.2 ga3 and 7.0 and writing about it here and tweeting about on @basicappsco

 

A13 Responsive Theme Stack on Liferay Marketplace

Targeting 6.2+

I am very pleased to announce that my first application was submitted to the Liferay Marketplace.   Its actually the Liferay theme that I'm using for this site as well!  If you are using Liferay 6.2 - I'd be happy if you find it useful!  Happy Coding :)

Welcome To Javablog

Welcome to Javablog.com

This site will be the space I will use to share things I've learned related to Java development professionally and for fun.  Enjoy

Ben Simpson