Recently at Ricston we have started using Spring Roo, which is a tool that makes it quick and easy to create web applications that adhere to the MVC architecture. When we first started using Roo, the version was 1.1.2. Soon after, a newer version was released, 1.1.3. However by the time this version was released, we already had a sizeable project underway. That meant that it was not feasible to create a new project using the new version from scratch and dragging in our implementation. This blog post briefly describes what we have done in order to upgrade the Roo version within an existing project.
This was not a simple case of updating the pom file to make use of Roo-1.1.3 rather than Roo-1.1.2, there were other aspects that had to be taken care of to implement the upgrade while inflicting as little “damage” as possible to our project. Springsource provide some information about upgrading the Roo version of a project, however we came across some additional issues in the process.
Since the beginning of our project in Roo, we decided that any Roo commands used, would be kept in a script.roo file. Any commands that are executed from the Roo shell in STS are automatically appended to log.roo, but we wanted to keep a structured document with all these commands. Keeping all the Roo commands used is useful in order to be able to generate the scaffolding of the same project structure at any time.
Before upgrading the Roo version, we created a dummy project using Roo-1.1.3 and the script.roo file that we maintained in the original project. This allowed us to verify that there were no changes made to the overall file structure. After this, we used Eclipse’s compare tool to compare the dummy project to the original project.
In the image above, there is a list of files at the top, these are not identical for both projects. At the bottom of the image is a comparison of the selected file. The pom file naturally contained a substantial amount of differences. The original pom file was updated by editing the dependency versions. There were also differences found in some of the ‘.tagx’ files, these were replaced in the original project by those generated from the dummy project. It was also noted that some files under the domain folder were different. However, upon a closer inspection, there did not seem to be too many differences in the functionality. Some code seems to have been re-ordered and in some cases methods have been split into several methods. We have left these files unchanged.
Another difference noted are the newly generated ‘*_Roo_Controller_Finder.java’ and ‘*_Roo_Controller_Json.java’ files. The ‘*_Roo_Controller_Json.java’ classes provide the controller methods in JSON format, while the ‘*_Roo_Controller_Finder.java’ adds a form and finder method for the controller.
There haven’t been any major issues encountered after upgrading from Roo-1.1.2 to Roo-1.1.3.
To summarise; the upgrade process was carried out by creating a second project with the newer version and the same roo commands used to create the original project, this was then compared to the original project to determine where changes need to be made.