Run GWT application in "hosted mode" from maven
It seems to get more and more cloudy in the IT world these days . It's a matter of time before the rain (of applications) starts. When this happen one will need the proper tools, to be able to add his/hers own few drops.
So I though it's about time to start experimenting with Google Web Toolkit. What I like the most about GWT is it's "hosted mode". The fact that Java code changes reflect the GUI right away and one don't have to wait for generate, compile, build, deploy, ... steps to complete is really speeding up the development process.
Since 99% of my projects use Maven the first thing to look for (after reading GWT tutorials) was a GWT maven plug-in. No surprise here - there is one (http://mojo.codehaus.org/gwt-maven-plugin). The GWT docs and gwt-maven-plugin docs gives a lot of information how to create and build GWT applications. Unfortunately the released version of gwt-maven-plugin (1.0 at the time of writing) does not support hosted mode.
The solution is to use the snapshot repository
<pluginRepository>
<id>mojo-snapshots</id>
<url>http://snapshots.repository.codehaus.org</url>
</pluginRepository>
and the 1.1-SNAPSHOT version :
<pluginManagement>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<version>1.1-SNAPSHOT</version>
</plugin>
</plugins>
</pluginManagement>
If the application only contains client code it can be then run in "hosted mode" by simply typing mvn gwt:run. The thing docs don't mention (again, at the time of writing this) is that "mvn gwt:run" will not build the server side of the application. Unless you do this yourself GWT-RPC call will not work. So there are three possible ways:
- let the Eclipse (or whatever IDE you use) build the classes in
${basedir}/src/main/webapp/WEB-INF/classes
I personally don't like this approach. It does not solve the problem if you have multiple modules in maven as the dependent libraries will be still missing. Also you have to add some rules to your SCM system to ignore generated classes. - do
mvn compile war:inplace gwt:run
This will create extracted version of the war in "${basedir}/src/main/webapp". It will solve the problem even for multiple modules setup but you still will have to deal with the SCM ignore rules. - do
mvn compile war:exploded gwt:run
This will create extracted version of the WAR in a specified directory (by default it is${project.build.directory}/${project.build.finalName}as stated in Maven WAR Plugin docs). In order for this to work thegwt-maven-pluginneeds to be told where the exploded war is by adding this to it's configuration in pom.xml :<hostedWebapp> ${project.build.directory}/${project.build.finalName} </hostedWebapp>
This IMHO is the best approach. Solves the problem even in case of multiple modules and your SCM managed folders remain clean.
ATG session tracking cookies and subdomains.
If an ATG based web application is available under few subdomains (domain.com, www.domain.com, shop.domain.com) keeping track of session cookies across subdomains may be a challenge. Session tracking cookies (like jsessionid) usually do not have domain property set, which means they are sent back to exactly the same host they came from. So if visitors switch to another subdomain while navigating through the application they would most likely end up having a new session. Depending on what information session holds, the number of visitors and how many simultaneous sessions the server can handle, this may or may not be a problem.
Creating Liferay portlet with liferay-maven-sdk
This post will demonstrate how liferay-maven-sdk can be employed to build a Liferay portlet using Liferay's Service Builder feature. For this purpose we will create service-builder-portlet which is capable of displaying a list of players and adding a new player to this list. The model, persistence layer and data access services will be generated by Service Builder.