Wednesday, 26 October 2011

Review of "Apache Maven 3 Cookbook" by "Srirangan"

This is a review of Apache Maven 3 Cookbook written by "Srirangan". I got a free copy from Packt publishing for the purpose of the review.  I have been using Maven for some years now and this book is a introductory book, so it was clear from the beginning that I am not in the target audience.

The style of splitting the book into 50 recipes makes for a good format which is easy to read and breaks the book into small achievements for the reader.

Instead of focusing solely on how Maven is configured, the author tries to tie some of the subjects to software development practices e.g. covering Nexus and Hudson while explaining team collaboration. It serves the book well to put Maven into a development perspective, but it doesn't always fit with the recipe format. For instance in the Nexus case from above the "How it Work" section becomes more a "why it is good" section.

I like the fact that the book covers a wide range of different project types and topics. Many times when you read tutorials or other documentation only the simplest project types are covered leaving the reader to add plugins as needed. This book covers many project types and framework and some non-Java areas. It also covers things like setting up Nexus,Hudson, various IDEs. It even has a single chapter on plugin development.

In the first chapter the level of information in each recipe is appropriate, but as the chapters get more complex the level of information does not. This results in many of the recipes being too simplistic. A prime example the is set-up of remote repositories, it describes in great many screen shots how to install tomcat 7 and deploy nexus, but only has a single line of information on how to set-up the remote repository, plus only mentions (incorrectly) changing the settings.xml and not the required changes to the project object model. So it fails to help the reader define and use the remote repository possible leaving the reader with a broken set-up

This simplistic approach has another side effect. In many of the recipes there is clear copy-paste'able examples but very little explanation of why things are the they are. An example would be the first recipe which introduce multi-module projects. In the top level project definition the dependencies are placed in "<dependencyManagment>" section instead of the normal "<dependencies>" section without an explanation of why.

Conclusion:
While I like the style and long list of topics covered in this book, I think the decision not the explain the details of why things work like they do e.g. <dependencies> vs <dependencyManagment> or how repositories works, does the book a big disservice.

I would not recommend learning Maven from this book alone, since I think explaining the "why" is an essential part of learning a new tool. If you want to learn Maven use the free sonatype book Maven: The Complete Reference and buy a copy of this book if you like a quick introduction to the various project types and plugins.

Thursday, 13 October 2011

Using the SoapUI maven integration

I have had the mixed pleasure of using the Maven integration for SoapUI (http://www.soapui.org/Test-Automation/maven-2x.html).

The tool itself is pretty good and makes it very easy to test that our soap based web-services are working as intended. The fact that is actually provides Maven and Junit integration out of the box is even better and fits very nicely with our CI environment.

There is however a few things that are not obvious when using the plugin.

The documentation page is really old, e.g. it refers to an old (2.5.1) version of the plugin. The trick here is that you should in general use the same version, as the desktop version you are running. In my case that is 4.0.0

It isn't documented on the page but there here is both a "maven-soapui-plugin" and "maven-soapui-pro-plugin" version of the plugin. In order to fully use project created using the pro version you need the pro version of the plugin

The version 4.0.0 of the plugin has a misconfiguration so you will need to manually add some dependencies to the plugin. The version I got working looks like this.
<plugin>
    <groupId>eviware</groupId>
    <artifactId>maven-soapui-pro-plugin</artifactId>
    <version>4.0.0</version>
    <configuration>
      ....
    </configuration>
    <executions>
      ....
    <executions>
    <dependencies>
        <dependency>
            <groupId>jgoodies</groupId>
            <artifactId>looks</artifactId>
            <version>2.2.0</version>
        </dependency>
        <dependency>
            <groupId>fife</groupId>
            <artifactId>rsyntaxtextarea</artifactId>
            <version>1.3.4</version>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.4</version>
        </dependency>                  
    </dependencies>
</plugin>
The two first dependencies are so that the plugin can run, and the last one is needed if there are any XPath assertions.

I have tried to upgrade to the latest 4.0.1 version which has just been released but I get the following error, so I suggest people stick to 4.0.0 for now

class "com.eviware.soapui.SoapUICore"'s signer information does not match signer information of other classes in the same package