You are on page 1of 29

www.flex­guse.

de

Tutorial setup Flex project with Maven
Version 1.0

Christoph Guse

Tutorial setup Flex project with Maven page 1 of 29
www.flex­guse.de

Table of contents
1 Preface............................................................................................................................................................................................. ............................3
1.1 Why do I write this tutorial? ............................................................................................................................................................. ......................3
1.2 What will you learn in this tutorial?................................................................................................................................................................. ........3
1.3 Who should read this tutorial?.................................................................................................................................................. .............................3
1.4 What are the templates for this tutorial?............................................................................................................................................................... ..4
2 Prerequisites................................................................................................................................................................................................... ..............5
2.1 Installation of Flex SDK in local Maven repository................................................................................................................................................. .5
2.1.1 Flex SDK download.......................................................................................................................................................... ..............................5
2.1.2 Flex SDK installation....................................................................................................................................................... ...............................5
3 Root maven project creation............................................................................................................................................................ .............................6
3.1 POM modifications............................................................................................................................................................................................. ....7
4 Flex subproject creation............................................................................................................................................................................... .................8
4.1 POM modifications............................................................................................................................................................................................. ....9
5 Flex configuration submodule creation....................................................................................................................................................... .................14
5.1 Flex configuration....................................................................................................................................................................................... ..........14
5.2 POM modifications............................................................................................................................................................................................ ...17
5.2.1 Step 1........................................................................................................................................................................................... ................17
5.2.2 Step 2......................................................................................................................................................................................................... ..18
6 Webapplication subproject creation..................................................................................................................................................................... ........19
6.1 POM modifications........................................................................................................................................................................................... ....20
6.2 Webapplication web.xml.................................................................................................................................................................... ..................24

Tutorial setup Flex project with Maven page 2 of 29
www.flex­guse.de

6.3 Maven and Java version......................................................................................................................................................................... .............25
6.4 Test the build process.................................................................................................................................................................................... ......26
7 Summary........................................................................................................................................................................................ ............................27

Tutorial setup Flex project with Maven page 3 of 29
www.flex­guse.de

1 Preface
Adobe Flex is a powerful tool to create nice Smart Clients. Adobe Flex Builder is a very nice IDE to use the Flex technology, but for building enterprise 
applications it lacks some functionality to manage the build process of large applications with several dependencies.

In the Java world Maven is the technology to manage complex applications with a lot of dependencies. Why not bring both technologies – Adobe Flex 
and Maven – together?

Fortunately the Flex community is very active and provides several solutions for Flex and Maven, so I'm able to combine several approaches and write 
this tutorial.

1.1 Why do I write this tutorial? 
Well, mainly to have guide for my own projects.

1.2 What will you learn in this tutorial?
You will learn to create a Maven Flex project skeleton which has a Webapplication .war file as build result which can be deployed in a Java webserver. 
The webapplication includes BlazeDS, so everything is provided to develop a Flex ↔ BlazeDS ↔ Java Smart Client Webapplication.

1.3 Who should read this tutorial?
This tutorial is dedicated to Java and Flex developers who want to put their development to a more professional level.

Tutorial setup Flex project with Maven page 4 of 29
www.flex­guse.de

1.4 What are the templates for this tutorial?
Sébastian Arbogast wrote an excellent three part article1 about Flex, Spring and BlazeDS. This is the original for this tutorial. 

Sébastian wrote the article for the Flex SDK 3. In the meanwhile Adobe released Flex SDK 3.1 and the mojos written by VELO2 have reached the 
version 2.0M5. This causes several changes in the Maven configuration which are covered in this tutorial.

1  http://www.adobe.com/devnet/flex/articles/fullstack_pt1.html 
2  http://blog.flex­mojos.info/ 

Tutorial setup Flex project with Maven page 5 of 29
www.flex­guse.de

2 Prerequisites
To use this tutorial you need Java 1.5 or above, Maven 2.0.9 or above, a download of Flex SDK 3.1.0.2710 and Internet access.

2.1 Installation of Flex SDK in local Maven repository
There is no official Flex SDK Maven repository, so you have to install the SDK 3.1.0.2710 locally in your Maven repository. Thanks to VELO3 there is an 
install mojo which makes the SDK installation very handy.

2.1.1 Flex SDK download

Download Adobe Flex SDK 3.1.0.27104 and unzip it somewhere in your filesystem

2.1.2 Flex SDK installation

To install the Flex SDK to your local maven repository open a command shell and use the maven command
mvn info.flex­mojos:install­mojo:2.0M5:install­sdk ­Dflex.sdk.folder=${flex sdk folder} ­Dversion=3.1.0.2710
Maven starts to work and should return "Build Successful".

3  http://blog.flex­mojos.info/2008/08/21/install­mojo/ 
4  http://opensource.adobe.com/wiki/display/flexsdk/Download+Flex+3 

Tutorial setup Flex project with Maven page 6 of 29
www.flex­guse.de

3 Root maven project creation
Create the root maven project using the maven command
mvn ­DgroupId={your group id} ­DartifactId={your artifact id} archetype:create
The groupId is something like 'de.flexguse' and the artifactId like 'demo' but this really depends on your project. Maven should start to work and give 
you a 'Build Successful'. 

Tutorial setup Flex project with Maven page 7 of 29
www.flex­guse.de

3.1 POM modifications
The pom.xml file created by Maven needs to be modified, the result must look like this:
<?xml version="1.0"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema­instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven­v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
   
    <parent>
        <groupId>info.flex­mojos</groupId>
        <artifactId>flex­super­pom</artifactId>
        <version>2.0­alpha4</version>
    </parent>
   
    <groupId>de.flexguse</groupId>
    <artifactId>demo</artifactId>
   
    <packaging>pom</packaging>
   
    <version>1.0­SNAPSHOT</version>
    <name>flex­mail</name>
    <url>http://maven.apache.org</url>
   
    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven­dependency­plugin</artifactId>
                    <version>2.0</version>
                </plugin>
                <plugin>

Tutorial setup Flex project with Maven page 8 of 29
www.flex­guse.de

                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven­assembly­plugin</artifactId>
                    <version>2.2­beta­2</version>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>
   
    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.4</version>
            <scope>test</scope>
        </dependency>
    </dependencies>
</project>

The changes are marked in bold letters.

The 'parent' node must be added so flex­mojo has all it's needed dependencies and repositories.

The 'packaging' value must be changed to have a root maven project.

The 'build' node is needed ­ well, I don't know it exactly.

The version of junit is changed because I prefer to use Junit 4.

4 Flex subproject creation
The Flex project is covered by the Root Maven application. Please navigate into the newly created root project folder in the command line and use the 

Tutorial setup Flex project with Maven page 9 of 29
www.flex­guse.de

Maven command:
mvn archetype:create ­DgroupId=de.flexguse ­DartifactId=demo­ria  ­DarchetypeGroupId=com.codeadept 
­DarchetypeArtifactId=flex­mojos­archetype ­DarchetypeVersion=1.0­SNAPSHOT ­DremoteRepositories=http:
//flexonjava.googlecode.com/svn/repository

The archetype was created by Jeremy Anderson5 and creates a complete Flex project.

4.1 POM modifications
The pom.xml created by the flex­mojos­archetype is not correct for the Flex SDK 3.1.0.2710, so we have to do some manual changes.

<?xml version="1.0"?>
<project>
<parent>
<artifactId>demo</artifactId>
<groupId>de.flexguse</groupId>
<version>1.0­SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>de.flexguse</groupId>
<artifactId>demo­ria</artifactId>
<packaging>swf</packaging>
<version>1.0­SNAPSHOT</version>

<properties>
<maven.test.skip>true</maven.test.skip>

5  http://blog.code­adept.com/2008/06/12/maven­archetype­for­flex­mojos/ 

Tutorial setup Flex project with Maven page 10 of 29
www.flex­guse.de

</properties>

<build>
<sourceDirectory>src/main/flex</sourceDirectory>
<testSourceDirectory>src/test/flex</testSourceDirectory>
<finalName>flex­timerecording­ria</finalName>
<plugins>
<plugin>
<groupId>info.flex­mojos</groupId>
<artifactId>flex­compiler­mojo</artifactId>
<extensions>true</extensions>
<configuration>
<locales>
<locale>en_US</locale>
</locales>
<contextRoot>demo</contextRoot>
</configuration>
</plugin>
<!­­
this plugin is needed to extract the BlazeDS configuration from the
zipped configuration
­­>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven­dependency­plugin
</artifactId>
<executions>
<execution>
<id>unpack­config</id>
<goals>
<goal>unpack­dependencies</goal>
</goals>
<phase>generate­resources</phase>
<configuration>

Tutorial setup Flex project with Maven page 11 of 29
www.flex­guse.de

<outputDirectory>${project.build.directory}/generated­resources
</outputDirectory>
<includeArtifacIds>demo­config</includeArtifacIds>
<includeGroupIds>${project.groupId} </includeGroupIds>
<excludeTransitive>true</excludeTransitive>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
<resources>
<resource>
<directory>${basedir}/src/main/resources</directory>
</resource>
<resource>
<directory>${basedir}/target/generated­resources</directory>
<filtering>true</filtering>
</resource>
</resources>
</build>
<dependencies>
<dependency>
<groupId>flexunit</groupId>
<artifactId>flexunit</artifactId>
<version>0.85</version>
<type>swc</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>flexunit.junit</groupId>
<artifactId>flexunit­optional</artifactId>
<version>0.85</version>
<type>swc</type>
<scope>test</scope>

Tutorial setup Flex project with Maven page 12 of 29
www.flex­guse.de

</dependency>
<dependency>
<groupId>com.adobe.flex.framework</groupId>
<artifactId>playerglobal</artifactId>
<version>9­3.1.0.2710</version>
<type>swc</type>
<scope>external</scope>
</dependency>
<dependency>
<groupId>com.adobe.flex.framework</groupId>
<artifactId>flex</artifactId>
<version>3.1.0.2710</version>
<type>swc</type>
</dependency>
<dependency>
<groupId>com.adobe.flex.framework</groupId>
<artifactId>framework</artifactId>
<version>3.1.0.2710</version>
<type>swc</type>
</dependency>
<dependency>
<groupId>com.adobe.flex.framework</groupId>
<artifactId>framework</artifactId>
<version>3.1.0.2710</version>
<type>resource­bundle</type>
<classifier>en_US</classifier>
</dependency>
<dependency>
<groupId>com.adobe.flex.framework</groupId>
<artifactId>rpc</artifactId>
<version>3.1.0.2710</version>
<type>swc</type>
</dependency>
<dependency>

Tutorial setup Flex project with Maven page 13 of 29
www.flex­guse.de

<groupId>com.adobe.flex.framework</groupId>
<artifactId>rpc</artifactId>
<version>3.1.0.2710</version>
<type>resource­bundle</type>
<classifier>en_US</classifier>
</dependency>
<dependency>
<groupId>com.adobe.flex.framework</groupId>
<artifactId>utilities</artifactId>
<version>3.1.0.2710</version>
<type>swc</type>
</dependency>
</dependencies>
<reporting>
<plugins>
<plugin>
<artifactId>maven­surefire­report­plugin
</artifactId>
<configuration>
<reportsDirectory>${project.build.directory}/test­reports</reportsDirectory>
</configuration>
</plugin>
</plugins>
</reporting>
</project>

The changes are marked in bold font. Please don't forget to put the artifactId of your configuration project (described in the next chapter) in
<includeArtifacIds>demo­config</includeArtifacIds>

In the node
<contextRoot>demo</contextRoot>

Tutorial setup Flex project with Maven page 14 of 29
www.flex­guse.de

you have to give the name of the WAR file we will create later in this tutorial. Normally this is the artifactId of the web project.

The build­plugin node can be removed completely, this information is now provided by the super­pom. 

The changes in the the groupId and the version of the dependencies are due to changes in the internal Flex SDK structure.

Finally I had to add the property to switch off running the testcases during the Maven build process because I use a linux environment and the 
gflashplayer can't be started which causes a build error.

5 Flex configuration submodule creation
The server part of the Flex smart client is BlazeDS. There must be some configuration in BlazeDS, so the Flex smart client can use Java POJOS on 
the server side.

Sébastien created an extra project which contains this configuration. 

To create the configuration submodule use the following Maven command in the root project folder.
mvn archetype:create ­DgroupId=org.epseelon.samples ­DartifactId=demo­config

5.1 Flex configuration
The configuration is done in two resource files: services­config.xml and remoting­config.xml. Create the folder 
resources 

Tutorial setup Flex project with Maven page 15 of 29
www.flex­guse.de

in 
demo­config/src/main.

Create the file services­config.xml in the new folder.
<?xml version="1.0" encoding="UTF­8"?>
<services­config>
  <services>
    <service­include file­path="remoting­config.xml" />
  </services>
 
  <channels>
    <channel­definition id="channel­amf"
       class="mx.messaging.channels.AMFChannel">
    <endpoint
       url="http://{server.name}:{server.port}/{context.root}/messagebroker/amf"
       class="flex.messaging.endpoints.AMFEndpoint" />
      <properties>
        <polling­enabled>false</polling­enabled>
      </properties>
    </channel­definition>
  </channels>
 
  <logging>
    <target class="flex.messaging.log.ConsoleTarget"
      level="Error">
      <properties>
        <prefix>[BlazeDS]</prefix>
        <includeDate>true</includeDate>
        <includeTime>false</includeTime>
        <includeLevel>true</includeLevel>
        <includeCategory>true</includeCategory>
      </properties>

Tutorial setup Flex project with Maven page 16 of 29
www.flex­guse.de

      <filters>
        <pattern>Endpoint.*</pattern>
        <pattern>Service.*</pattern>
        <pattern>Message.*</pattern>
        <pattern>DataService.*</pattern>
        <pattern>Configuration</pattern>
       </filters>
    </target>
  </logging>
 
  <system>
    <redeploy>
      <enabled>true</enabled>
      <watch­interval>20</watch­interval>
      <watch­file>
        {context.root}/WEB­INF/flex/services­config.xml
      </watch­file>
      <watch­file>
        {context.root}/WEB­INF/flex/remoting­config.xml
      </watch­file>
      <touch­file>{context.root}/WEB­INF/web.xml</touch­file>
    </redeploy>
  </system>
</services­config>

Create the file remoting­config.xml in the newly created folder.

<?xml version="1.0" encoding="UTF­8"?>
<service id="remoting­service"
class="flex.messaging.services.RemotingService">
 
  <adapters>

Tutorial setup Flex project with Maven page 17 of 29
www.flex­guse.de

    <adapter­definition id="java­object"
      class="flex.messaging.services.remoting.adapters.JavaAdapter"
      default="true" />
  </adapters>
 
  <default­channels>
    <channel ref="channel­amf" />
  </default­channels>
 
  <!­­  
  <destination id="todoService">
    <properties>
      <source>de.flexguse.someClass</source>
      <scope>application</scope>
    </properties>
  </destination>
   ­­>
</service>

The escaped destination node is an example how to address a Java class.

I don't want to explain the BlazeDS configuration, please refer to

http://livedocs.adobe.com/blazeds/1/blazeds_devguide/

for a full overview of all configuration options.

5.2 POM modifications
Maven must be tought to use the Flex configurations files. This is done in two steps.

Tutorial setup Flex project with Maven page 18 of 29
www.flex­guse.de

5.2.1 Step 1

In step 1 the pom.xml of the configuration subproject must be modified.
<?xml version="1.0"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema­instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven­v4_0_0.xsd">
<parent>
<artifactId>demo</artifactId>
<groupId>de.flexguse</groupId>
<version>1.0­SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>de.flexguse</groupId>
<artifactId>demo­config</artifactId>
<name>demo­config</name>
<version>1.0­SNAPSHOT</version>
<url>http://maven.apache.org</url>
<packaging>pom</packaging>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven­assembly­plugin</artifactId>
<executions>
<execution>
<id>make shared resources</id>
<goals>
<goal>single</goal>
</goals>
<phase>package</phase>

Tutorial setup Flex project with Maven page 19 of 29
www.flex­guse.de

<configuration>
<descriptors>
<descriptor>src/main/assembly/resources.xml</descriptor>
</descriptors>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

5.2.2 Step 2

In the modified pom.xml there is the referenced file resources.xml in the folder
demo­config/src/main/assembly
You have to create the folder and the file.
<assembly>
  <id>resources</id>
  <formats>
    <format>zip</format>
  </formats>
  <includeBaseDirectory>false</includeBaseDirectory>
  <fileSets>
    <fileSet>
      <directory>src/main/resources</directory>
      <outputDirectory></outputDirectory>
    </fileSet>
  </fileSets>
</assembly>

Tutorial setup Flex project with Maven page 20 of 29
www.flex­guse.de

To check your configuration you can run
mvn package
in the command line. Maven must build with success and in the target folder there must be a 
*­resources.zip
which includes the configuration files services­config.xml and remoting­config.xml.

6 Webapplication subproject creation
The webapplication subproject is built by the Maven command
mvn archetype:create ­DgroupId=de.flexguse ­DartifactId=demo­web ­DarchetypeArtifactId=maven­archetype­webapp 

This is a common archetype provided by Maven.

6.1 POM modifications
There must be several modifications in the pom.xml file because the used archetype doesn't know anything about BlazeDS and the configuration 
which shall be used. For my demo application the pom.xml in the webapplication subproject must look like this:
<?xml version="1.0"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema­instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven­v4_0_0.xsd">
<parent>

Tutorial setup Flex project with Maven page 21 of 29
www.flex­guse.de

<artifactId>demo</artifactId>
<groupId>de.flexguse</groupId>
<version>1.0­SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>de.flexguse</groupId>
<artifactId>demo­web</artifactId>
<packaging>war</packaging>
<name>demo­web Maven Webapp</name>
<version>1.0­SNAPSHOT</version>
<url>http://maven.apache.org</url>
<repositories>
<repository>
<id>epseelon­repository</id>
<url>http://m2repo.epseelon.org/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>epseelon­repository</id>
<url>http://m2repo.epseelon.org/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>

Tutorial setup Flex project with Maven page 22 of 29
www.flex­guse.de

</pluginRepositories>
<build>
<finalName>demo­web</finalName>
<resources>
<resource>
<directory>src/main/resources</directory>
</resource>
<resource>
<directory>src/main/java</directory>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
<includes>
<include>**/*.xml</include>
</includes>
</resource>
</resources>
<plugins>
<plugin>
<artifactId>maven­dependency­plugin</artifactId>
<executions>
<execution>
<id>unpack­config</id>
<goals>
<goal>unpack­dependencies</goal>
</goals>
<phase>generate­resources</phase>
<configuration>

<outputDirectory>${project.build.directory}/${project.build.finalName}/WEB­INF/flex</outputDirectory>
<includeArtifacIds>demo­config</includeArtifacIds>
<includeGroupIds>${project.groupId}</includeGroupIds>
<includeClassifiers>resources</includeClassifiers>
<excludeTransitive>true</excludeTransitive>

Tutorial setup Flex project with Maven page 23 of 29
www.flex­guse.de

<excludeTypes>jar,swf</excludeTypes>
</configuration>
</execution>
<execution>
<id>copy­swf</id>
<phase>process­classes</phase>
<goals>
<goal>copy­dependencies</goal>
</goals>
<configuration>

<outputDirectory>${project.build.directory}/${project.build.finalName}</outputDirectory>
<includeTypes>swf</includeTypes>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>com.adobe.blazeds</groupId>
<artifactId>blazeds­common</artifactId>
<version>3.0.0.544</version>
</dependency>
<dependency>
<groupId>com.adobe.blazeds</groupId>
<artifactId>blazeds­core</artifactId>
<version>3.0.0.544</version>
</dependency>
<dependency>
<groupId>com.adobe.blazeds</groupId>
<artifactId>blazeds­remoting</artifactId>
<version>3.0.0.544</version>

Tutorial setup Flex project with Maven page 24 of 29
www.flex­guse.de

</dependency>
<dependency>
<groupId>backport­util­concurrent</groupId>
<artifactId>backport­util­concurrent </artifactId>
<version>3.1</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>demo­config</artifactId>
<version>1.0­SNAPSHOT</version>
<classifier>resources</classifier>
<type>zip</type>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>demo­ria</artifactId>
<version>${project.version}</version>
<type>swf</type>
</dependency>
</dependencies>
</project>

The dependency nodes are the BlazeDS part. In the build node we link to the configuration subproject. 

The repository and the pluginrepository must be given here, because there is no official BlazeDS Maven repository. Sébastien Arbogast maintains the 
BlazeDS jars in his private repository.

Please ensure that in the nodes (in italic font)
includeArtifacIds

Tutorial setup Flex project with Maven page 25 of 29
www.flex­guse.de

and
artifactId
of the last dependency node there is the name of your configuration project!

You can test your work so far by using 
mvn package

in the root project folder. In the target folder of the webapplication project there must be a .war file containing the BlazeDS libraries, the BlazeDS 
configuration and a Hello World Flex application.

6.2 Webapplication web.xml
So far the webapplication is not ready to provide BlazeDS. We included the JAR files but we have to modify the web.xml a little bit.

First of all we have to register the BlazeDS messagebroker servlet. Please add
<context­param>
  <param­name>flex.class.path</param­name>
  <param­value>/WEB­INF/flex/hotfixes</param­value>
</context­param>
 
<!­­ MessageBroker Servlet ­­>
<servlet>
  <servlet­name>MessageBrokerServlet</servlet­name>
  <servlet­class>
    flex.messaging.MessageBrokerServlet

Tutorial setup Flex project with Maven page 26 of 29
www.flex­guse.de

  </servlet­class>
  <init­param>
    <param­name>services.configuration.file</param­name>
    <param­value>/WEB­INF/flex/services­config.xml</param­value>
  </init­param>
  <init­param>
    <param­name>flex.write.path</param­name>
    <param­value>/WEB­INF/flex</param­value>
  </init­param>
  <load­on­startup>1</load­on­startup>
</servlet>
 
<servlet­mapping>
  <servlet­name>MessageBrokerServlet</servlet­name>
  <url­pattern>/messagebroker/*</url­pattern>
</servlet­mapping>

in the web­app node of the web.xml file.

6.3 Maven and Java version
Maven needs a build plugin to know which Java version it uses. Please add
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven­compiler­plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>

Tutorial setup Flex project with Maven page 27 of 29
www.flex­guse.de

either to the root project pom.xml (recommended) or to the webproject pom.xml file.

6.4 Test the build process
If you want to see if everything was configured properly, please go to the root project and give
mvn clean package

in the command prompt. Maven starts to work. You can watch that all three projects (configuration project, ria project and web project) are built by 
Maven. This takes on my machine about 20 seconds and after that Maven must report BUILD SUCCESSFUL.

You can check the build result in the target folder of the web project. There must be a WAR file
demo­web.war

which includes three BlazeDS libs and the backport­util­concurrent lib in the 
WEB­INF/lib 

folder, both BlazeDS XML configuration files in 
WEB­INF/flex 

and 
demo­ria.swf 

Tutorial setup Flex project with Maven page 28 of 29
www.flex­guse.de

in the root folder.

7 Summary
In this tutorial you created a complete project setup for a Flex webapplication with Maven. The result is a 'Hello World' application which is the base for 
your further development. 

For example you can implement your complete business logic into the webapplication,  deploy the created WAR file into a Java Application Server, run 
mvn eclipse:eclipse 

in the ria subproject, import it into FlexBuilder and develop the GUI.

Please leave me a note on www.flex­guse.de if you found errors in this tutorial.

Tutorial setup Flex project with Maven page 29 of 29

You might also like