In March 2008 I started experimenting with flex and java integration. I wrote a lot of blog posts since than and even published an article on adobe.com. For most of my blog items I used a sample that is available on google code called books-overview. During the years the sample improved a lot. By now the sample consists of Mate, BlazeDS, Spring BlazeDS and a lot of other spring technologies like spring security.
I was some time a go I had a look at the sample, since than a lot of people keep coming back to it. I still get questions about it. Therefore I decided to upgrade the sample. This blog post is about the upgrade I did which are mainly upgrades in versions of the libraries and the build configuration. Still I think it is worthwhile to have a look at it.
Before I start with this blog post I need to warn you that I am not going to explain a lot of the internals. Please browse my other flex 3 blog items to find out more.
Library upgrade
The client (flex) side
For the flex building I use Mate. I think mate is a nice framework, but it is not very active. Not many improvements are created. Still it does the job. I am also creating a flex sample for the Axon Framework using Parsley. Stay tuned for a blog post that is around the corner about this sample. I upgrade the mate to release 0.8.9
Another framework I use on the flex side is the spring-actionscript project. This project changed a lot since the last time I used it. I am now using version 0.8.1. This project is now split up into a few other modules. I did have a problem with the StringUtils class. This is in as3commons:as3commons-lang. By transitive dependecy you get 0.1 of this library. I had to upgrade to version 0.2 to make it work.
The serverside
I did not upgrade a lot on the serverside. I could have upgrade to spring 3, I’ll wait till it becomes the default for the spring blazeds integration project. They still use version 2.5.6, so I’ll stick with that. I did upgrade the Spring Blazeds Integration project to the latest release: 1.0.2.RELEASE.
Building and developing
The biggest change was in the maven configuration. Flex-mojos made a lot of improvements and is now tightly integrated with Intellij. To me that is incredibly important. My development speed with flex has enormously increased.
I use flex-mojos version 3.5.0. The configuration is now very easy. For the war project you just need to add the following plugin plus configuration:
<plugin> <groupId>org.sonatype.flexmojos</groupId> <artifactId>flexmojos-maven-plugin</artifactId> <version>${flex-mojos.version}</version> <executions> <execution> <goals> <goal>copy-flex-resources</goal> </goals> </execution> </executions> </plugin>
Now let us have a look at the configuration of the swf file. Again it is pretty straightforward. You have to add the flex-framework as a dependency.
<dependency> <groupId>com.adobe.flex.framework</groupId> <artifactId>flex-framework</artifactId> <version>${flex.sdk.version}</version> <type>pom</type> </dependency>
Finally we have to configure the flex-mojos compiler plugin.
<plugin> <groupId>org.sonatype.flexmojos</groupId> <artifactId>flexmojos-maven-plugin</artifactId> <version>${flex-mojos.version}</version> <extensions>true</extensions> <configuration> <debug>true</debug> <configurationReport>true</configurationReport> </configuration> <dependencies> <dependency> <groupId>com.adobe.flex</groupId> <artifactId>compiler</artifactId> <version>${flex.sdk.version}</version> <type>pom</type> </dependency> <dependency> <groupId>com.adobe.flex.compiler</groupId> <artifactId>asdoc</artifactId> <version>${flex.sdk.version}</version> <classifier>template</classifier> <type>zip</type> </dependency> </dependencies> </plugin>
The configurationReport parameter is used by intellij. This creates an xml file that intellij uses to set you compiler properties in intellij. Very nice.
Repositories
I also want to mention the additional repositories I configured. I added a repository for libraries coming from flex-mojos and another library for the spring-actionscript libraries.
<repository> <id>flexmojos-repository</id> <url>http://repository.sonatype.org/content/groups/flexgroup/</url> </repository> <repository> <id>yoolab.org-releases</id> <url>http://projects.yoolab.org/maven/content/repositories/releases</url> <releases> <enabled>true</enabled> </releases> </repository>
The only library I still cannot find online is Mate. Therefore I added it to my google code repository. Please do the same thing if you need it for your own project. Do not use my repository because I will reach my maximum bandwidth and then I have to take it away again.
If you want to check out the state of the project while I was writing this blog, use the following tag:
http://code.google.com/p/gridshore/source/browse/#svn/tags/books-overview-1.0.0
Hope this is helpfull when exploring my sample, feel free to post remarks, improvements and questions.