Flex-mojos 2.0-alpha3

After a few time working on issues and on get a better test coverage, here is a new flex-mojos release.

On flex-mojos alpha2 the test coverage was near to 44% (blocks). Now, on alpha3 code coverage is 81% (blocks). While I was writing those extra integration tests I was able to find and fix some unknown issues.

BTW, I take some time to fix issues too. 8 issues closed:
* Issue 12 - now you can run a quick build by typing mvn install -Dquick.compile=true. It will compare the last generated artifact with current sources. If there is any new code, will recompile. If not will skip compilation.
* Issue 43 - flex-mojos will ignore test errors using -Dmaven.test.failure.ignore=true (same expression used by surefire)
* Issue 53 - flex-mojos will skip test running with -DskipTests=true. It will compile the tests. But will not run they.
* Issues 67 and 68 some fixes on AsDoc support.
* Issue 69 flex-mojos tests runner will add a sandbox exception to run tests. To do that just need to add the configuration updateSecuritySandbox. Default value is false.
* Issue 70 just a cosmetic change on flex-super-pom.
* Issue 71 fixed an old issue on compiled localization support. After Adobe feedback was piece of cake =P

This version should be flex-mojos most stable release.

VELO

Flex-mojos compiling Flex 4 Gumbo?

Hi folks,

Some time ago, I wrote a post showing how to update compiler version.

But is possible to compile Flex 4 with flex-mojos?

First, I take this sample source.

Then, I use this knowledge to upgrade flex-oem-compiler to 4.0.0.2480.

Try to compile and got this error:

[ERROR] D:\flex\workspace\sonatype-flex-mojos\flex-mojo-IT\src\test\resources\flex4-gumbo\src\main\flex\Flex4App.mxml:[-1,-1] Unable to locate specified base class ‘flex.core.Application’ for component class ‘Flex4App’.

At this point I figure out flex gumbe came with some new manifest files:

    gumbo-manifest.xml
    fxg-manifest.xml
    mxml-2009-manifest.xml
    mxml-manifest.xml

To handle this, I add those xml to my project and this configuration:

  <build>
    <plugins>
...
      <plugin>
        <groupId>info.flex-mojos</groupId>
        <artifactId>flex-compiler-mojo</artifactId>
        <extensions>true</extensions>
        <configuration>
...
          <namespaces>
            <namespace>
              <uri>library:adobe/flex/gumbo</uri>
              <manifest>gumbo-manifest.xml</manifest>
            </namespace>
            <namespace>
              <uri>library:adobe/flex/halo</uri>
              <manifest>mxml-manifest.xml</manifest>
            </namespace>
            <namespace>
              <uri>http://ns.adobe.com/mxml/2009</uri>
              <manifest>mxml-2009-manifest.xml</manifest>
            </namespace>
            <namespace>
              <uri>http://www.adobe.com/2006/mxml</uri>
              <manifest>mxml-manifest.xml</manifest>
            </namespace>
            <namespace>
              <uri>http://ns.adobe.com/fxg/2008</uri>
              <manifest>fxg-manifest.xml</manifest>
            </namespace>
          </namespaces>
        </configuration>
      </plugin>
    </plugins>
  </build>

In the end, run mvn clean install, all compile and fine.

You can checkout this entire post source from:
http://svn.sonatype.org/flexmojos/trunk/rvin-mojo/flex-mojo-IT/src/test/resources/flex4-gumbo/

Hopefully all required dependencies are on flex-mojos maven(svn) repository. Let me know if I miss something.

VELO

Flex-mojos 2.0 roadmap

Hi folks,

Some time ago I created a flex-mojos 2.0 roadmap:
http://code.google.com/p/flex-mojos/wiki/roadmap2

Now I wanna get some feedback. What do you think about this roadmap? Are you missing something? If you can change this list, what you like to change?

Please, post any comments on wiki.

VELO

FlexUnit Test Reports

Some time ago, I write a post with instructions to generate test reports here.

At that time, flex-mojos was generating the reports at wrong directory. To workaround it, was necessary to declare reportsDirectory.

Now this issue is fixed. To generate test reports you only need this:

<reporting>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-report-plugin</artifactId>
      </plugin>
    </plugins>
  </reporting>

Note reportsDirectory is not present anymore.

Flex-mojos 2.0-alpha2

Hi guys,

A new flex-mojos release is out.

Main changes:
* Now is possible to pack tests into SWC. Read more here.
* Improved flex-compiler-mojo documentation, specially adding usage hints for complex parameters.
* Some fixes on docs site (http://docs.flex-mojos.info/)
* Update generator mojo to use GAS3 1.1.0-RC2 (thanks to Juraj Burian)
* Fixed some issues: 58, 59, 60, 61, 62, 63, 64 and 65.

That’s All Folks

VELO

Attached tests

Hi folks…

To test flex applications, flex-mojos compile and run a SWF file. Nothing new on that.

But, under certain circumstances (i.e. on multi-modular projects) you need to get access to some classes used to test your module A in order to test module B. One issue was filed asking that, check here.

To do that, you need to add a new mojo to your project:

<build>
  <plugins>
    <plugin>
      <groupId>info.flex-mojos</groupId>
      <artifactId>flex-compiler-mojo</artifactId>
      <executions>
        <execution>
          <id>package</id>
          <goals>
            <goal>test-swc</goal>
          </goals>
        </execution>
      </executions>
    </plugin>
  </plugins>
</build>

This plugin will compile your test folder into a SWC file. This SWC will be installed at maven repository under test classifier.

You can read more on Maven Guide to using attached tests.

Nice holiday to US buddies.

VELO

Sebastien stack is back… part 2

Sebastien still posting.

Some day ago I blog the link for the first part.

You can check the second part at:
http://www.adobe.com/devnet/flex/articles/fullstack_pt2.html

Good reading.

VELO

Adding libraries to compilation…

This is a how to post.

When developing with flex, is very common the need for 3rd party libraries to build more elaborated application.  If you wanna charts you must add datavisualization.swc.  If wanna SHA1 algoritm you need as3corelib. So go on…

Using Adobe’s command line compilers (mxmlc and compc) you will use any (or many) parameters from this list:

-compiler.external-library-path
-compiler.include-libraries
-compiler.library-path
-runtime-shared-library-path

But on flex-mojos that options are not available.  If there is no option available, how to add dependencies?

Simple, following maven way =D

Each required library must be add as a dependency.  So, if you need datavisualization you will add a dependency like this:
<dependency>
<groupId>com.adobe.flex.sdk</groupId>
<artifactId>datavisualization</artifactId>
<version>3.0.0.477</version>
<type>swc</type>
</dependency>

One big question: How to discovery dependency groupId and artifactId?
Well who make the library must define it. Since maven is not very popular on flex world it provably will not be defined and not available at any maven repository.

When you face this, you will define your own groupId/artifactId and install on your repository by hand.

Maven Guide to installing 3rd party JARs

Often times you will have 3rd party JARs that you need to put in your local repository for use in your builds. The JARs must be placed in the local repository in the correct place in order for it to be correctly picked up by Maven. To make this easier, and then error prone, we have provide a goal in the install plug-in which should make this relatively painless. To install a JAR in the local repository use the following command:
mvn install:install-file -Dfile= -DgroupId= \
-DartifactId= -Dversion= -Dpackaging=

You can follow the same logic for swc libraries.

And how to define how the dependency should be used? If it should be external, how to get it?
Defining dependency scope:
<dependency>
<groupId>com.adobe.flex.sdk</groupId>
<artifactId>datavisualization</artifactId>
<version>3.0.0.477</version>
<type>swc</type>
<scope>external</scope>
</dependency>

Flex-mojos supports 6 scopes:

    external to -compiler.external-library-path
    internal to -compiler.include-libraries
    merged to -compiler.library-path
    rsl to -runtime-shared-library-path for SWF files
    caching to -runtime-shared-library-path for SWZ files
    test to -compiler.library-path only for test running

If not defined will assumed merged as default.

To read more about flex-mojos scopes click here.

Have a nice weekend every body.

VELO

Html Wrapper Mojo

Hi folks,

This week we make public the first release of HtmlWrapperMojo.

This guy is used to generate the html to open flex applications, like what is done by flex builder.

To enable it, just add this new mojo on plugins section:

<build>
  <plugins>
    <plugin>
      <groupId>info.flex-mojos</groupId>
      <artifactId>html-wrapper-mojo</artifactId>
      <executions>
        <execution>
          <goals>
            <goal>wrapper</goal>
          </goals>
        </execution>
      </executions>
    </plugin>
  </plugins>
</build>

A simple hello world can be view here.

It’s very simple to use, and has no need of configurations do get it running.

It support all standard templates made by Adobe. Just need to define templateURI parameter. Valid values to templateURI:
class:client-side-detection
class:client-side-detection-with-history (default)
class:express-installation
class:express-installation-with-history
class:no-player-detection
class:no-player-detection-with-history

You can even point to a file using “file:///etc/hosts”. This file must be a zip and must have index.template.html inside it.

When using custom templates you may need to set custom parameters on your index.template.html. This can be done by configuring parameters:

<parameters>
	<swf>${build.finalName}</swf>
	<width>100%</width>
	<height>100%</height>
</parameters>

All required parameters to Adobe’s template are defined by default. But you can overwrite they at any time.

Any suggestions?

VELO

Flex-mojos 2.0-alpha1

This week we start to run flex-mojos 2.0 roadmap.

For alpha1 we have achieve this goals:

    Change all groupIds to info.flex-mojos.
    Generation of optimized RSLs (on alpha2)
    archetypes mojos.
    Some PMD fixies, not all, but some on compiler.

One new mojo was released too: HtmlWrapperMojo. To generate html wrapper. More details on a dedicated post.

So, keep in mind, to use flex-mojos 2.0-alpha1, you need to change the groupIds.

Good weekend to every one.

VELO