Since Portofino 4.2.2, a new feature allows for a "development mode" that makes working with Portofino Maven-based projects even quicker.

The problem: the biggest part of a Portofino application is defined by directories inside WEB-INF/pages. Those are easily added, moved, configured etc. through the web UI provided by Portofino. However, Groovy sources and other files are better edited in an IDE, and when you develop with Maven, the source you're editing is not directly deployed under Tomcat or your favorite application server. So, in order not to lose modifications you made through the web UI every time you deploy, you have to copy them back to the source directory, while being careful not to overwrite files you modified in your IDE in the meantime.

Tools like Unison help in that regard and we used them successfully in many projects. Another strategy is to have two projects, one that builds an empty webapp with Portofino + project-specific dependencies, and another one that points to the actual app deployed to the application server.

In Portofino 4.2.2, we added the possibility to store the Portofino app - pages, properties, model - outside the web application (.war). This is useful in production deployments to separately version and backup the app for example, but as it happens it is also useful while developing - because you can deploy to e.g. Tomcat but make Portofino point to your source directory when accessing application files!

So, how do you do it? A barebones example follows.

First, you need to enable resource filtering for web.xml (where the path to the app is configured) by configuring a Maven plugin in your app's pom.xml:


Then, in web.xml, add:


et voilĂ ! Edit stuff in your IDE and immediately see the changes in the live application and vice-versa!

This simple example is not the whole story - you'll want to enable this configuration only during development, while keeping production and other environments clean. The .war built with this configuration, in fact, will only work on your machine, because it will point to the absolute path where you're storing your app's source code.

Maven profiles are a possible solution. A separate dev branch in your VCS tree is another option. Anyway, this is a good start that you can further adapt to your needs.

Add new attachment

Only authorized users are allowed to upload new attachments.
« This page (revision-3) was last changed on 11-Aug-2016 14:45 by