<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>byte bohemian &#187; Flex-mojo</title>
	<atom:link href="http://nicl.net/category/technology/adobe-flash/adobe-flex/flex-mojo/feed/" rel="self" type="application/rss+xml" />
	<link>http://nicl.net</link>
	<description></description>
	<lastBuildDate>Sat, 15 May 2010 20:51:01 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Some thoughts  about building</title>
		<link>http://nicl.net/2009/11/some-thoughts-about-building/</link>
		<comments>http://nicl.net/2009/11/some-thoughts-about-building/#comments</comments>
		<pubDate>Sat, 07 Nov 2009 13:31:33 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Agile software development]]></category>
		<category><![CDATA[Flex-mojo]]></category>
		<category><![CDATA[Maven]]></category>

		<guid isPermaLink="false">http://nicl.net/?p=49</guid>
		<description><![CDATA[Over the last few days I had some thoughts about building your project. I am using Apache Maven for quite a while now. At my current employer we use Maven for all our components even our learn portal which is build entirely in Adobe Flex, using the Flexmojos.
The bottom line is that we have approximately [...]]]></description>
			<content:encoded><![CDATA[<p>Over the last few days I had some thoughts about building your project. I am using <a href="http://maven.apache.org">Apache Maven</a> for quite a while now. At my <a href="http://www.scoyo.de">current employer</a> we use Maven for all our components even our learn portal which is build entirely in <a href="http://www.adobe.com/products/flex/">Adobe Flex</a>, using the <a href="http://flexmojos.sonatype.org/">Flexmojos</a>.</p>
<p>The bottom line is that we have approximately 100 projects build with maven to build our entire platform. You don't need much imagination that we have a couple of challenges to meet.<span id="more-49"></span>I started with <a href="http://maven.apache.org/maven-1.x/index.html">Maven 1</a> which was a astonishing mixture of <a href="http://ant.apache.org/">Apache Ant</a> and <a href="http://ant.apache.org/">Jelly</a>. But I never really liked the idea of executable XML. In my opinion XML is not a good programming language at all but this would be a blog posting of its own <img src='http://nicl.net/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p>Back to to the builds. A couple of days ago a read some <a href="https://twitter.com/hlship/status/5408252622">tweets</a> from the <a href="https://twitter.com/hlship">the man behind tapestry</a> to remind me about <a href="http://buildr.apache.org/">Apache Buildr</a>. This lead to rethink some experiences I made with <a href="http://maven.apache.org">Maven2</a> in the last couple of month...</p>
<p>This lead to certain discoveries what I started to really dislike on Maven2:</p>
<ol>
<li><i>The XML</i> - The <code>pom.xml</code> which defines the central project object model os getting really cluttered. When you have a small project there is almost no problem but if you have an enterprise scale project (almost evereything after an example project) the <code>pom.xml</code> is getting huge and you don't find the things you need.
<p>Okay, there are "helpers" to maintain the <code>pom.xml</code>, but e.g. if you use <a href="http://www.eclipse.org">Eclipse</a> with a POM file the XML editor starts to parse it. If the file is no very small - even a small open source project like <a href="http://jaev.googlecode.com">jaev</a> has an approx. 140 lines <code>pom.xml</code> - it'll make Eclipse somewhat slow. If you use the <a href="http://m2eclipse.sonatype.org/">m2eclipse</a> plugin it will get even worse. The <a href="http://m2eclipse.sonatype.org/">m2eclipse</a> offers some very nice tools for POM handling and it got really good compared to the early versions. But I know a couple of guys who refuse to use it because of the negative impact on your development environment.
</li>
<li><i>Reuse by inheritance</i> - The only way (so far I know <img src='http://nicl.net/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' />  ) to reuse settings in Maven2 is POM inheritance. This works like prototypic inheritance (like in Javascript). You may define prototypic plugin settings in the parent POM and all POMs which inherit from this parent POM will use this settings as a default.
<p>So far so good, but in most object oriented programming languages inheritance to reuse code is considered to be a bad design pattern. In Maven2 you may stumble across the same bad issues as e.g. in Java when you use the POM inheritance. As a matter of fact you may only inherit from one parent POM, so your inheritance tree will get cluttered with settings and overrides.
</li>
<li><i>Insufficient version and dependency management</i> - The dependency management is one of Maven2 strongpoints, no doubt about it. But if you really start to use it you'll get to it's limits very fast.
<p>I guess Maven2 did some awesome pioneer work to version handling. Due to the fact that every artifact has a version number. Unfortunately the version numbers in Maven do not have an ordinal structure and admits special indicators like <code>SNAPSHOT</code>, <code>alpha</code> or <code>LATEST</code> which are adding a whole new level of complexity. So maven can't tell if a version is greater than another version, e.g. is <code>1.4-SNAPSHOT</code> greater than <code>1.4</code>?. This is very problematic when use version ranges and transitive dependencies. When you'll get a dependency from different sources (e.g. the commmons-lang library) there is always some magic involved which version you'll get. This leads to next next issue:
</li>
<li><i>The build does not break early enough.</i> - Maven2 tries to be very clever in some situations like the dependency resolution. If a problem occurs maybe a log message will be provided but the build will continue even if you have contradictory dependency declarations. So the only "hint" you'll get, if the dependency tree is faulty, are compile errors if you're lucky. If you have runtime dependencies you'll get some funny effects in your application
</li>
<li><i>No separation of concerns.</i> - The POM includes all concerns of a build like:
<ul>
<li>Dependency management</li>
<li>Compiling</li>
<li>Tesing</li>
<li>Packaging</li>
<li>Reporting</li>
<li>Deployment</li>
</ul>
<p>You'll have different sections in the <code>pom.xml</code> like <code>&lt;build/&gt;</code>,  <code>&lt;dependencies/&gt;</code>, <code>&lt;profiles/&gt;</code> or  <code>&lt;reporting/&gt;</code> which group the declarations a little bit. But if you take a closer look at the <code>&lt;build/&gt;</code> section you'll soon realize that it works quite different that e.g. the <code>&lt;dependencies/&gt;</code> section. In the <code>&lt;build/&gt;</code> you are more on a programming level to specify the compile and packaging issues of your build. The <code>&lt;dependencies/&gt;</code> is only declarative.</li>
<li><i>Only one file</i> - To make the lack of separation more painful you are not able to break the different concerns into separate files. There are some Maven plugins which use other files like the assembly plugin, but this an exception. It would be really nice if out could include files into your <code>pom.xml</code>. This really could have positive effects on the inheritance issue too.
</li>
</ol>
<p>Okay to straighten this a little bit. I guess the Apache Maven did some of the most innovative work on the build sector in the last few years. And I don't  consider to switch to <code>make</code> or <a href="http://ant.apache.org/">Apache Ant</a>. It makes many things a lot easier and most of my critique may be corrected in further versions <img src='http://nicl.net/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' />  I already had a peek into the Maven3 source code and I'll guess the Maven/<a href="http://www.sonatype.com/">Sonartype</a> guys will level some of this issues. I 'am very curious about Maven3 and I hope it will ease some of my pain related to the Version 2 of Maven.</p>
<p>So, it was great to get some thoughts clear about what is important when you build a project and what are the different facets when you use a build tool. I had a first look on <a href="http://buildr.apache.org/">Apache Buildr</a> maybe I get enough stuff together to create a blog entry about it ...</p>
]]></content:encoded>
			<wfw:commentRss>http://nicl.net/2009/11/some-thoughts-about-building/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Maven and Flex hoodoo</title>
		<link>http://nicl.net/2009/05/maven-and-flex-hoodoo/</link>
		<comments>http://nicl.net/2009/05/maven-and-flex-hoodoo/#comments</comments>
		<pubDate>Fri, 15 May 2009 16:11:56 +0000</pubDate>
		<dc:creator>niclas</dc:creator>
				<category><![CDATA[Adobe Flash]]></category>
		<category><![CDATA[Adobe Flex]]></category>
		<category><![CDATA[Flex-mojo]]></category>
		<category><![CDATA[Maven]]></category>

		<guid isPermaLink="false">http://87.106.3.237/?p=33</guid>
		<description><![CDATA[
The last time when I blogged about the Flex mojos I was still quite frustrated and thought I had a better solution. Now some time passed and on April the 3rd the new version (3.1) of the flex mojos was released and me and some of my colleges made some interesting discoveries.


The last time when [...]]]></description>
			<content:encoded><![CDATA[<p>
The last time <a href="/2009/03/mavenizing-a-flex-build/">when I blogged about the Flex mojos</a> I was still quite frustrated and thought I had a better solution. Now some time passed and on April the 3rd the <a href="http://flex-mojos.info/2009/04/03/ann-flexmojos-31-released/">new version (3.1) of the flex mojos was released</a> and me and some of my colleges made some interesting discoveries.</p>
<p><span id="more-33"></span>
<p>
The last time <a href="/2009/03/mavenizing-a-flex-build/">when I blogged about the Flex mojos</a> I was still quite frustrated and thought I had a better solution. Now some time passed and on April the 3rd the <a href="http://flex-mojos.info/2009/04/03/ann-flexmojos-31-released/">new version (3.1) of the flex mojos was released</a> and me and some of my colleges made some interesting discoveries.</p>
<p>
Well, but in the last few weeks I often thought about the meaning and the source of the word mojo. Lets take a closer look at <a href="http://en.wikipedia.org/wiki/Mojo_(African_American_culture)">wikipedia.</a></p>
<blockquote cite="http://de.selfhtml.org/">
<p>
Mojo (pronounced /ˈmoʊdʒoʊ/) is a term commonly encountered in the African-American folk belief called hoodoo. A mojo is a type of magic charm, often of red flannel cloth and tied with a drawstring, containing botanical, zoological, and/or mineral curios, petition papers, and the like. It is typically worn under clothing.</p>
</blockquote>
<p>Okay, hoodoo! That explains quite a lot. Sometimes maven and the flex-mojos are a kind of magic.
</p>
<p>
But let's get back on topic <img src='http://nicl.net/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' />  The boys from the Flex mojos where quite busy and created with the 3.x release very usable platform for flex builds in the maven world. It took us (mainly a <a href="http://www.peter-jacobsen.de/">freelance colleague</a>) two more weeks to adapt our build process form various ant scripts into a multi-module maven2 build. But now it looks quite nice, the build is even faster and we were able to fix a problem with our Flex Builder configuration.</p>
]]></content:encoded>
			<wfw:commentRss>http://nicl.net/2009/05/maven-and-flex-hoodoo/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mavenizing a Flex build</title>
		<link>http://nicl.net/2009/03/mavenizing-a-flex-build/</link>
		<comments>http://nicl.net/2009/03/mavenizing-a-flex-build/#comments</comments>
		<pubDate>Sat, 21 Mar 2009 12:54:51 +0000</pubDate>
		<dc:creator>niclas</dc:creator>
				<category><![CDATA[Adobe Flash]]></category>
		<category><![CDATA[Adobe Flex]]></category>
		<category><![CDATA[Flex-mojo]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Maven]]></category>

		<guid isPermaLink="false">http://nicl.net/2009/03/21/mavenizing-a-flex-build/</guid>
		<description><![CDATA[In the last week the release 1.0 platform release of scoyo came close and we were tying up some loose ends. One of these ends was the integration of the scoyo Flash/Flex portal build process  into the platform build process.
The platform build process is realized with Apache Maven, which is, in humble my opinion, [...]]]></description>
			<content:encoded><![CDATA[<p>In the last week the release 1.0 platform release of <a href"http://www.scoyo.de">scoyo</a> came close and we were tying up some loose ends. One of these ends was the integration of the scoyo Flash/Flex portal build process  into the platform build process.</p>
<p>The platform build process is realized with <a href="http://maven.apache.org">Apache Maven</a>, which is, in humble my opinion, still the first choice for <a href="http://java.sun.com">Java</a> based software projects, but integrating other project types into maven is a kind of challenging due to the nature of Maven. You may summarize this in: If you do it the maven way it's very easy, if you don't it is up to you ...</p>
<p>Luckily there was already an existing build with <a href="http://ant.apache.org">Ant</a> and a dysfunctional Maven variant with the Maven <a href="http://code.google.com/p/flex-mojos/">Flex-mojos</a> plugin. So it stated  my journey to insanity an back ...<br />
<span id="more-22"></span><br />
In the last week the release 1.0 platform release of <a href"http://www.scoyo.de">scoyo</a> came close and we were tying up some loose ends. One of these ends was the integration of the scoyo Flash/Flex portal build process  into the platform build process.</p>
<p>The platform build process is realized with <a href="http://maven.apache.org">Apache Maven</a>, which is, in humble my opinion, still the first choice for <a href="http://java.sun.com">Java</a> based software projects, but integrating other project types into maven is a kind of challenging due to the nature of Maven. You may summarize this in: If you do it the maven way it's very easy, if you don't it is up to you ...</p>
<p>Luckily there was already an existing build with <a href="http://ant.apache.org">Ant</a> and a dysfunctional Maven variant with the Maven <a href="http://code.google.com/p/flex-mojos/">Flex-mojos</a> plugin. So it stated  my journey to insanity an back.</p>
<p>My first attempts started  with reactivating the Flex-mojos maven build. I already had some experience with Flex-mojos when preparing the build for the <a href="http://jaev.googlecode.com">jaev</a> Flex example. This example Project for the <a href="http://jaev.googlecode.com">jaev</a> framework also uses the Flex-mojos maven plugin to create the example <code>.swf</code> and uses the infrastructure of maven to assemble the web application with the HTML and the <a href="http://opensource.adobe.com/wiki/display/blazeds/BlazeDS/">BlazeDS</a> services. Took me some time and a quite nice <a href="http://sebastien-arbogast.com/2008/04/10/flex-spring-and-blazeds-the-full-stack/">tutorial</a> from <a href="http://sebastien-arbogast.com/">Sébastien Arbogast</a> but finally it worked!</p>
<p>So I thought I was prepared for the task and nothing could stop me. There is no law against being wrong, at least in Germany <code> <img src='http://nicl.net/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </code>.</p>
<p>The main problems was finding all the required libraries in various maven repositories. Additionally there were some foul libraries. Some yahoo uploaded HTML files as <code>.pom</code> and <code>.jar</code> file in a repository. It took me quite a moment to realize this. Unfortunately the current <a href="http://www.adobe.com/products/flex/flexdownloads/">Flex SDK 3.3</a> was not available at all in any maven repository. At least I did not find any.</p>
<p>So after wasting some hours I changed the strategy: My new Idea was to call the Flex <a href="http://livedocs.adobe.com/flex/3/html/help.html?content=anttasks_1.html">Ant tasks</a> provided by <a href="http://www.adobe.com">Adobe</a> from the maven build using the <a href="http://maven.apache.org/plugins/maven-antrun-plugin/">maven-antrun-plugin</a>. The antrun-plugin is quite nice if you have to perform some tasks not covered by maven. So you can execute some <a href="http://ant.apache.org">Ant</a><a> tasks to enrich your build.</p>
<p>But things where going to be worse. A couple of very "unsatisfying" hours later I discovered a bug or incompatibility of the maven </a><a href="http://maven.apache.org/plugins/maven-antrun-plugin/">maven-antrun-plugin</a> and the Adobe <a href="http://livedocs.adobe.com/flex/3/html/help.html?content=anttasks_1.html">Ant tasks</a>. So it was time to rethink my strategy again. Should I switch back to the Flex-mojo approach? I went for a minor adjustment first: Instead of using the the <a href="http://livedocs.adobe.com/flex/3/html/help.html?content=anttasks_1.html">Ant tasks</a> I went for the compilers (<code>mxmlc</code> for Flex applications and <code>compc</code> for Flex libraries) directly. Calling them with the Ant <a href="http://ant.apache.org/manual/CoreTasks/exec.html"><code>&lt;exec /&gt;</code></a> task, which executes a command on the command line. Then use the <a href="http://maven.apache.org/plugins/maven-assembly-plugin/">maven-assembly-plugin</a> to create a ZIP file of the compiled artifact and install/deploy it into the repository.</p>
<p>Let's sum this up:
<ol>
<li>start JVM and execute maven</li>
<li>execute the maven-antrun-plugin to execute ant tasks</li>
<li>use some Ant tasks to assemble the Flex build path (external and included libraries)</li>
<li>use the Ant <code>&lt;exec /&gt;</code> task to execute the flex compiler (let's share a secret: The Flex compilers are written in Java. Welcome back home <code> <img src='http://nicl.net/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </code>)</li>
<li>use the maven-assembly-plugin</li>
<p> to create a ZIP file</p>
<li>install the ZIP file into the local repository</li>
<li>(optionally deploy the artifact into a remote repository)</li>
</ol>
<p>That does not sound like a simple build process. And let me amend something: If you a using shared libraries in the build (yepp we have a couple of them) you may add another step before invoking the maven-antrun plugin. You'll have to use the maven dependency plugin to copy and uncompress the libraries from the local (remote) repository to your build environment, so they can be accessed/found by the build. You'll imagine I was not satisfied at all with this build variant ...</p>
<p>Again my old friend came along, the question:"What to do?"</p>
<p>The Flex-mojo approach obliged my to upload the whole Flex SDK into our local <a href="http://archiva.apache.org/">archiva</a> installation which hosts out company maven repository. This includes the minimum 54 libraries supplied by the Flex SDK. Okay most of them are quite common, but when a new Flex SDK is released (which happens on a quite regular basis) you'll have to recheck all dependencies. No thanks ...<br />
The maven/Ant/Flex compiler variant emerged as juggernaut with bad performance and a loads of catches. No improvement at all ...</p>
<p>So I decided to take a closer look at the Flex-mojo plugin itself. Why do I need to have all this dependencies? The major advantages to the Flex-mojo plugin are the special packaging types <code>swf</code> and <code>swc</code> for Flash movies and libraries. Using this packaging types maven will use a special life cycle and offer the possibility to install/deploy the artifacts directly into the repository. To my relief only a <a href="http://svn.sonatype.org/flexmojos/trunk/flexmojos-maven-plugin/src/main/resources/META-INF/plexus/components.xml">quite simple XML file</a> (a plexus component definition) was necessary to achieve this.</p>
<p>So desperate as I was, I decided to write a maven plugin on my own. I must confess it was not my first time. I already wrote a simple maven plugin for the <a href="http://www.sinnerschrader.de">SinnerSchrader commerce framework</a>, a library developed by my former employer. I really do not like to reinvent software on my own. But I was curious and I want to give it a shot. My goal was to combine the two approaches I tried before and use the best of both. So the plugin should be able to manage the <code>swc</code> dependencies, the flex compiler configuration (via <code>-load-config</code>) and the direct deployment of <code>swc</code> and <code>swf</code> artifacts.</p>
<p>The approach was simple:
<ol>
<li>check the maven dependencies for libraries to reference or to include</li>
<li>check for a configured compiler configuration</li>
<li>create the compiler command line and all options like <code>-load-config</code>, <code>-compile.debug</code>, <code>-compiler.include-libraries</code> or <code>-compiler.external-library-path</code>, etc. </li>
<li>invoke the compiler via the<a href="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/ProcessBuilder.html"><code>java.lang.ProcessBuilder</code></a></li>
<li>install the artifact into the local repository</li>
</ol>
<p>It took me not an hour to build a working proof of concept and only approx. four more hours to mavenize almost the entire build. This was really fun after two days of trying and failing. There are still some minor adjustments to make on monday, but I am really looking forward to finish the build. And if all works out as I want, there might be a 15-20% speed improvements for a complete build. But this also reduces the necessity to perform complete builds, because some shared libraries are rarely changing at all, so we can deploy them into our company maven repository.</p>
<p>As I went to bed last night, I was wondering why the Flex-mojo approach failed and the home-grown maven plugin approach succeeded. Under the shower this morning it was quite obvious to me. The Flex-mojo plugin stores the whole Flex SDK in maven repositories, so you don't even have to download the Flex SDK to compile your Flex application. My home-grown plugin needs the Flex SDK installed on the build computer and the <code>FLEX_HOME</code> environment variable set. But that is okay, because the <a href="http://maven.apache.org/plugins/maven-compiler-plugin/">maven-compiler-plugin</a> does the same. It does not work without the <code>JAVA_HOME</code> set and it does not try to deploy the Java SDK into maven repositories. Maybe the Flex-mojo guys will also realize the difference. It seems to be a quite nice piece of software but with too much unnecessary complexity and very "clustered" documentation.</p>
<p>After tying up this loose end me and a very experienced Flex development colleague already discovered some further TODOs relating to the maven and <a href="http://www.adobe.com/products/flex/features/flex_builder">Flex Builder</a> integration. There is still lots of work to do, so I am exited. My <a href="http://www.scoyo.de">new job</a> is different as I expected but a am very confident that it will offer some exiting further challenges for me ...</p>
]]></content:encoded>
			<wfw:commentRss>http://nicl.net/2009/03/mavenizing-a-flex-build/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
