Re: Using multiple AS3 source folders

122 views
Skip to first unread message

Frank

unread,
Jan 9, 2013, 4:15:41 AM1/9/13
to jangaro...@googlegroups.com
Hi Cameron,

welcome to Jangaroo!

Well, you can define multiple source directories in Maven, using a special Maven plugin, but regarding your use case, this is not the way you would do it.

Maven's primary goal is to allow modular development, so Flixel, Greensock etc. would be modules that are built separately and then referenced as dependencies by your application.
For Flixel, this has even already been done and works very well, so you can reuse my Jangaroo Flixel Maven module (use "beta" branch):
git clone https://github.com/fwienber/flixel
git checkout beta
Note that I used Flixel 2.34.
Then, follow along the lines of one of the Flixel demo applications I also ported, e.g. "Jumper":
git clone https://github.com/fwienber/jumper
The central part is to declare a dependency on the Flixel module in your application's pom.xml:
    <dependency>
      <groupId>net.jangaroo.flash.flixel</groupId>
      <artifactId>flixel</artifactId>
      <version>1.0.0-1-SNAPSHOT</version>
      <type>jangaroo</type>
    </dependency>

For a general understanding of how a multi-Maven-module Jangaroo project works, you might also want to have a look at
https://github.com/CoreMedia/jangaroo-quickstart
and the corresponding documentation at
https://github.com/CoreMedia/jangaroo-tools/wiki/Maven-Build-Process

Actually, the idea behind Maven modules is that you could even reuse the Flixel module without cloning and building the project, because Maven modules can be released and deployed to a Maven repository. Currently I cannot release Flixel because our Jangaroo Maven repository is no longer used: we now release directly to Maven Central so that Jangaroo modules can be used without additional configuration of repositories in your POM. I have to adjust the Flixel POM so that is releases to Maven Central, too. But as said, for the time being, you can clone (or download) and build the Flixel module yourself, and it will be in your local Maven repository. The advantage is that you can tweak Flixel if needed.

Feel free to come back here if you get stuck somewhere along the way. Using Maven is a bit to learn in the beginning, but when you are in the third or fourth project, it really pays off!

Greetings
-Frank-

Cameron Foale

unread,
Jan 9, 2013, 7:29:38 PM1/9/13
to jangaro...@googlegroups.com
Fantastic, thanks very much Frank. 

I was treating Maven more like Ant I suppose, and missed the whole concept of a local repository. Your quickstart project looks like a great starting point.

My projects are using (a very slightly modified) Flixel 2.43, so I'll have to investigate your beta changes to see what tweaks need to be done, but I'm happy enough trying to bundle it myself.

Thanks for your reply,
Cam.

Srinivasan MK

unread,
Apr 16, 2013, 8:19:04 AM4/16/13
to jangaro...@googlegroups.com
Hi Frank,

I now have a project that has multiple source directories (AS3 Files ) since some of them share with our old flash games. I tried using the Maven build helper plugin. Though the maven declares build succeeded, 
     [INFO] Nothing to compile - all classes are up to date 
no files are available in the target folder. Can you please let me know where I am wrong.

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>build-helper-maven-plugin</artifactId>
    <executions>
        <execution>
            <phase>generate-sources</phase>
            <goals><goal>add-source</goal></goals>
            <configuration>
                <sources>
                    <source>./flash/common</source>
                    <source>.jangaroo/common</source>
</sources> </configuration> </execution> </executions> 
</plugin> 

Frank

unread,
Apr 18, 2013, 8:11:41 AM4/18/13
to Jangaroo Users
Sorry for the late response.
What you do is completely right for Java Maven projects, but
unfortunately does not work for the Jangaroo Maven plugin.
It only uses a single source directory, which is by default the
standard Maven source directory ${project.build.sourceDirectory}.
Until we fix that, is it maybe possible for you to move the code to a
single directory and specify exclusions/inclusions for Jangaroo (and
for the "real" Flash compiler)?
For Jangaroo, you would add a <configuration> section to the jangaroo-
maven-plugin containing <excludes><exclude>...</exclude></excludes>
elements for the directories that must not be compiled or (if that is
easier) <includes><include>...</include></includes> elements for what
should actually be compiled. You can use the usual Maven/Ant wildcards
(src/main/joo/foo/** etc.).
Hope this helps,
-Frank-

Srinivasan MK

unread,
Apr 19, 2013, 8:49:11 AM4/19/13
to jangaro...@googlegroups.com
Hi Frank,

Thanks for your reply. I tried using the <configuration> <excludes> node , but still the flash directory is not excluded. Is there anything wrong in the way I am using the excludes?. Also If I use <includes><include>.. </include></includes>, the files are not getting compiled. The target folder is empty. 

  <build>
    <sourceDirectory>./trunk</sourceDirectory>
    <plugins>
      <plugin>
        <groupId>net.jangaroo</groupId>
        <artifactId>jangaroo-maven-plugin</artifactId>
        <extensions>true</extensions>
<configuration>
<excludes>
<exclude>./trunk/flash/</exclude>
</excludes>
</configuration>
        <version>1.0.0</version>

BTW, Is the fix on using build helper maven plugin in the pipeline? 

Thanks again in advance

Regards

MK


Frank

unread,
Apr 22, 2013, 1:01:39 PM4/22/13
to Jangaroo Users
Yeah, I didn't tell you that Maven treats the <exclude> elements as
relative to the source directory, so my example was rather confusing
and in your case it would simply have to be

<exclude>flash/</exclude>

(mind the trailing slash!)

The fix for the build helper maven plugin is not yet in the pipeline,
I guess we would have to use a different Maven API to acquire all
source roots. The Jangaroo compiler can already work with several
source paths, it is just a question on how to retrieve the source
directories set by the build helper maven plugin.

-Frank-
Reply all
Reply to author
Forward
0 new messages