Archive for May, 2008

Generating FlexUnit Test Reports with Flex Mojos

Thursday, May 29th, 2008

The original post is from Justin, and can be found here.

Just need to add this to pom.xml:

<reporting>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-report-plugin</artifactId>
        <configuration>
          <reportsDirectory>${project.build.directory}/test-reports</reportsDirectory>
        </configuration>
    </plugin>
    </plugins>
  </reporting>

Good tests for every one.

VELO

Maven Archetype’s for Flex

Sunday, May 25th, 2008

Well, we don start flex-mojos archetypes, but, someone did ;)

Please take a look at François blog.

VELO

Flex-mojos 1.0-RC2

Monday, May 19th, 2008

It’s on repository.

This version intent to be last RC, if no issues are found this week 1.0 will be released.

Still following rc1 line.

Enjoy it.

VELO

Flash Player 10

Friday, May 16th, 2008

If is possible to use flex-mojos with flex SDK 3.0.1, is possible to use flex-mojos to do tests with Flash Player 10.

This sample is available here. Is required to use flex-compiler-mojo 1.0-beta5-SNAPSHOT or any newer.

Looking at this I learn how to configure a common environment to use fp10. Them, I configure flex SDK 3.0.1.1728 on flex mojos (like this).

The steps to enable fp 10 usage are this:

    Add target player 10.0.0 configuration:

<targetPlayer>10.0.0</targetPlayer>

    Them add plugin dependency:

<plugin>
<groupId>info.rvin.mojo</groupId>
<artifactId>flex-compiler-mojo</artifactId>
....
<dependencies>
<dependency>
<groupId>com.adobe.flex</groupId>
<artifactId>flex-compiler-oem</artifactId>
<version>3.0.1.1728</version>
</dependency>
</dependencies>
</plugin>

    In the end update project dependencies:

<dependencies>
<dependency>
<groupId>com.adobe.flex.sdk</groupId>
<artifactId>playerglobal</artifactId>
<version>10.0.0-beta-051508</version>
<type>swc</type>
<scope>external</scope>
</dependency>
<dependency>
<groupId>com.adobe.flex.sdk</groupId>
<artifactId>framework</artifactId>
<version>3.0.1.1728</version>
<type>swc</type>
</dependency>
<dependency>
<groupId>com.adobe.flex.sdk</groupId>
<artifactId>framework</artifactId>
<version>3.0.1.1728</version>
<type>resource-bundle</type>
<classifier>en_US</classifier>
</dependency>
</dependencies>

This 3 steps are done on this pom.

Ok, flex-mojos is flash-player 10 ready. Them what? How do I prove it’s fp 10 ready?

I copy this sample.

When I tried to compile go this erro:

[ERROR] D:\flex\workspace\mojo\flex-mojo-IT\src\test\resources\flash-player-10\src\main\flex\main.mxml:[10,-1] Implicit coercion of a value of type String to an unrelated type int.

Perfect, generics working =D

Now I need to found some real use for flash player 10. Any ideas?

VELO

Using flex-mojos with flex SDK 3.0.1 or any newer…

Thursday, May 15th, 2008

Hi guys…

Some folks are asking about using flex-mojos with Flex 2. Well, so far the answer is no!

But it make me curious. Is possible to run flex-mojos with any newer flex SDK.

Well, the answer looks like to be yes =D, but only with maven 2.0.9 =/

The key to do that is maven 2.0.9 capability to override plugin’s dependency. You can read more here.

Adobe provides night build for flex SDK, so you just need to pick one version here.

While flex SDK is not available on any maven repository, there is some hand work to get flex SDK installed on maven repository. So far, there are only to version available on flex-mojos repo: 3.0.0.477 and 3.0.1.1092.

And how to update flex-mojos compiler to 3.0.1.1092?

Just update flex-mojos dependency to flex-compiler-oem:

<plugin>
<groupId>info.rvin.mojo</groupId>
<artifactId>flex-compiler-mojo</artifactId>
<dependencies>
<dependency>
<groupId>com.adobe.flex</groupId>
<artifactId>flex-compiler-oem</artifactId>
<version>3.0.1.1092</version>
</dependency>
</dependencies>
</plugin>

Keep in mind this flex-compiler-oem has other dependencies inside he, so, if you plan try flex-mojos with flex 4 don’t forget to make the right pom.xml for flex-compiler-oem.

There is a sample here.

As far I can tell, SDK 3.0.1 is a little faster. But no magic gain.

VELO

Flex-mojos on M2eclipse

Thursday, May 15th, 2008

Some people are asking for better maven (in this case flex-mojos) and eclipse (flexbuilder) better integration.

And I was answering soon, soon, will be done…

Well, it’s under way, not by me, not by flex-mojos, but is under way.

Jason create this issue on M2Eclipse project to handle this.

I’m very happy with this, flex-mojos helping and being helped by other projects.

This week Eugene start to work on this issue. When I can I do some support.

Maven I can help.
Flex I can help.
Eclipse API I can cry.
FlexBuilder API I can cry even more.
=P

If anyone can/wanna help…

Well, keep tuned on this issue for news.

Nice week to every one.

VELO

Flex-mojos 1.0-RC1

Monday, May 12th, 2008

Flex-mojos is reaching its maturity as an open source project.

At this point we have defined the scope for flex-mojos 1.0. These mojos will be released in final version:

    flex-compiler-mojo - Flex/AIR compilation mojo for swc and swf. Supports RSL, L10N, module and several advanced features. We think the compiler covers all MXMLC and COMPC options.
    unit-test-mojo - For the time being this feature is under flex-compiler-mojo. It supports flex-unit based on ant support. Some project members are working on getting FUnit and dpuint support.
    asdoc-mojo - Asdoc generation without configuration. Easy to use, very transparent and covering mostly used ASDOC features.
    source-mojo - source artifact generation, java-like. Generates a zipped file with project sources. The view-source-mojo version is now 2.0.
    generator-mojo - based on GraniteDS GAS3 generator. This mojo reads jar dependencies and generates .as files for DTO’s (mojos, VO’s, or whatever you call those). In the final release we intent to support more styles (default is granite style).

The project is growing. We are now 5 developers, 2 of them working exclusively on unit-test-mojo, 1 helping me out on everything, especially with issues, 1 on documentation, and myself working on issues, new mojos, user support, documentation, a little bit of everything.

We have also started running some tests with flex-sdk 3.0.1. Flex-mojos works without code changes, which is very good. It looks to be a little faster. I will publish instructions showing how to do that.

This final version is our first maturity test. I hope everyone likes it and gets the same benefits as we did.

Still, we need some community support. We have several issues pending at Adobe. Some bugs on flex-compiler-oem, so we need votes =D. If someone can call Adobe™’s attention for our issues, that would be great. Check Issues in vote’s need list on the blog.

If you have any issue with this release, please file a bug on the project site or post on the user list.

You can get more information on:

http://blog.flex-mojos.info/

http://docs.flex-mojos.info/

http://code.google.com/p/flex-mojos/

To get started:

http://blog.flex-mojos.info/2008/03/29/more-them-a-hello-world/

http://sebastien-arbogast.com/index.php/2008/04/10/flex-spring-and-blazeds-the-full-
stack/

Thanks for everyone’s support. Special thanks to Logan, Sebastien, Joost, Shane, Matt and Michael

VELO

Generator Mojo

Thursday, May 8th, 2008

Hi folks!!

On Flex we have several ways to integrate java-server and flex-client. My favorite is using RemoteObjects and/or Dataservices.

Using this, we have typed communication, but, it mean you must have the same DTO (Data Transfer Object or ValueObject or Pojo or whatever you use) on both side. That mean 2 sources files with same data.

Its common one side goes out-to-date. One good policy is write one side DTO and generate other. Is exactly that what Granite GAS3 Generator does.

Gas 3 is a AntTask to generate .as files based on .java files.

In other to get this behavior on flex-mojos I use Gas3’s generator on flex-mojos.

It works on a similar way. But it doesn’t run over a java project, it runs on a flex project.

There is a partial sample here.

The steps to get code generation are simple:
1 - Add generator mojo goal to your pom:

<plugin>
<groupId>info.rvin.mojo</groupId>
<artifactId>generator-mojo</artifactId>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
</plugin>

2 - Add a jar dependency, who contains Java DTO classes:

<dependency>
<groupId>info.rvin.itest</groupId>
<artifactId>generator-jar</artifactId>
<version>1.0-SNAPSHOT</version>
<type>jar</type>
</dependency>

All jar dependencies will be loaded at runtime. To filter what classes to generate use includeClasses/excludeClasses configuration.

3 - Update sourcePath:

<plugin>
<groupId>info.rvin.mojo</groupId>
<artifactId>flex-compiler-mojo</artifactId>
<configuration>
<sourcePaths>
<path>${project.build.sourceDirectory}</path>
<path>${project.build.directory}/generated-sources</path>
</sourcePaths>
</configuration>
</plugin>

4 - Compile your project.

Its the first release, and this project was only used on sample projects, so bugs are expected, please, don’t delete your .as DTOs, at least not now.

At this moment, it generate the sources with GAS3 style. But, I create this mojo with different styles in mind. Still, you can configure your custom template.

Well, I hope everyone enjoins it.

VELO

Aplicações localizadas (L10N applications)

Saturday, May 3rd, 2008

Hello folks,

Let’s show how flex-mojos can be used to generate resource-bundles.

To start, I strongly recommend you read this.

This is a good start to understand how Runtime Localization work. And, with this in mind we can show how to use flex-mojos to create Runtime Localized applications.

  • Compiled Localization

Here you can get the source for FlightReservationSamples 1 and 2.

So, lets start from begging. Download FlightReservation1 Sample and import it to FlexBuilder.

In other to compile this Sample1 with flex-mojos, we need to add this pom:

<?xml version="1.0" encoding="UTF-8"?>
<project>

<parent>
<groupId>info.rvin.mojo</groupId>
<artifactId>flex-super-pom</artifactId>
<version>1.0-beta2</version>
</parent>

<groupId>com.adobe.flex.samples</groupId>
<artifactId>FlightReservation1</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>swf</packaging>

<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<groupId>info.rvin.mojo</groupId>
<artifactId>flex-compiler-mojo</artifactId>
<configuration>
<sourceFile>FlightReservation1.mxml</sourceFile>
<mergeResourceBundle>true</mergeResourceBundle>
<resourceBundlePath>${basedir}/locale/{locale}</resourceBundlePath>
</configuration>
</plugin>
</plugins>
</build>

</project>

During this post I figure out flex-mojos will not be able to compile FlightReservation1.
Found a bug, issue on adobe, and post stop on the middle.
https://bugs.adobe.com/jira/browse/SDK-15453

I strongly believe is a bug because when I define locales en_US,ja_JP all appears in English. When I define ja_JP,en_US all appears in Japanese. Lets wait Adobe’s feedback.

  • Runtime Localization

Well, lets do to the second sample. Download it from here. Again, import it on FlexBuilder.

Another pom is required for this project:

<?xml version="1.0" encoding="UTF-8"?>
<project>
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>info.rvin.mojo</groupId>
<artifactId>flex-super-pom</artifactId>
<version>1.0-beta2</version>
</parent>

<groupId>com.adobe.flex.samples</groupId>
<artifactId>FlightReservation2</artifactId>
<version>1.0-SNAPSHOT</version>

<packaging>swf</packaging>

<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<groupId>info.rvin.mojo</groupId>
<artifactId>flex-compiler-mojo</artifactId>
<configuration>
<debug>true</debug>
<sourceFile>FlightReservation2.mxml</sourceFile>
<mergeResourceBundle>false</mergeResourceBundle>
<resourceBundlePath>${basedir}/locale/{locale}</resourceBundlePath>
<locales>
<param>en_US</param>
<param>ja_JP</param>
</locales>
</configuration>
</plugin>
</plugins>
</build>

<dependencies>
<dependency>
<groupId>com.adobe.flex.sdk</groupId>
<artifactId>framework</artifactId>
<version>3.0.0.3.0.0.477</version>
<type>resource-bundle</type>
<classifier>ja_JP</classifier>
</dependency>
<dependency>
<groupId>com.adobe.flex.sdk</groupId>
<artifactId>rpc</artifactId>
<version>3.0.0.3.0.0.477</version>
<type>resource-bundle</type>
<classifier>ja_JP</classifier>
</dependency>
</dependencies>

</project>

So, lets explain this pom.

    sourceDirectory: define sources located at src directory.
    mergeResourceBundle: when is false resource-bundle files are not merged into SWF, so, we got runtime resource-bundle.
    resourceBundlePath: folder when .properties files are located. {locale} is replaced at runtime by locale
    locales: define what locales should be generated.

So, running mvn clean install you will got 3 artifacts:

[INFO] [install:install]
[INFO] Installing D:\FlightReservation2\target\FlightReservation2-1.0-SNAPSHOT.swf to c:\repository\com\adobe\flex\samples\FlightReservation2\1.0-SNAPSHOT\FlightReservation2-1.0-SNAPSHOT.swf
[INFO] Installing D:\FlightReservation2\target\FlightReservation2-1.0-SNAPSHOT-en_US.swf to c:\repository\com\adobe\flex\samples\FlightReservation2\1.0-SNAPSHOT\FlightReservation2-1.0-SNAPSHOT-en_US.swf
[INFO] Installing D:\FlightReservation2\target\FlightReservation2-1.0-SNAPSHOT-ja_JP.swf to c:\repository\com\adobe\flex\samples\FlightReservation2\1.0-SNAPSHOT\FlightReservation2-1.0-SNAPSHOT-ja_JP.swf

One unlocalized swf and two resources swfs (one per locale).

In order to run that, all files must be copied into any HTTP server with html wrappers. I don’t know why, but runtime localization only run with html wrapper.

So, while flex-mojos doesn’t generate html wrapper, it can be download from here.

I just copy and rename swf files.

Both projects are available on SVN under it folder.

VELO

Maven Doc

Saturday, May 3rd, 2008

Some days ago we release maven documentation at docs.flex-mojos.info.

There is the initial maven documentation.

Right now there is no usage samples, but we are working on this.

VELO