Hi Vaibhav,

If you are building an swf there can only be one source mxml as this is what's 
used when you execute the application.
In SWF you have a single source file and the flex compiler adds all mxml and as 
classes that are directly and indirectly referenced from that.
You could add an additional MXML or AS class and simply reference Main, 
Secondary1, Secondary2 and Secondary3 from that file.

But to me it looks as if you are trying to compile a library. In that case you 
should remove the sourceFile config option and change the packaging to swc 
instead of swf. This will create a library that contains all classes - but is 
not an executable SWF anymore.

If it's not a library, could you please explain why you want to have multiple 
sourceFiles? Which effect are you expecting?

Chris



Am 08.02.18, 07:20 schrieb "Vaibhav Shah" <vaibhav.s...@barclays.com>:

    Hello,
    
    *Currently working code:*
    
    I am able to build a flex project using flexmojos-maven-plugin successfully.
    However, I can only provide one 'sourceFile' under my plugin configuration.
    Refer below my working pom.xml, which builds Main.mxml file correctly from
    'src' directory. It generates the 'swf' file for Main.mxml successfully:
    
    <?xml version="1.0" encoding="UTF-8"?>
    <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>
    
        <groupId>com.test</groupId>
        <artifactId>TA_UI_Test2</artifactId>
        <version>1.0-SNAPSHOT</version>
        <packaging>swf</packaging>
        <name>TA_UI_Test2 Flex</name>
    
        <dependencies>
            <dependency>
                <groupId>com.adobe.flex.framework</groupId>
                <artifactId>playerglobal</artifactId>
                <version>10-3.3.0.4852</version>
                <type>swc</type>
            </dependency>
            <dependency>
                <groupId>com.adobe.flex.framework</groupId>
                <artifactId>rpc</artifactId>
                <version>4.5.1.21328</version>
                <type>swc</type>
            </dependency>
            <dependency>
                <groupId>com.adobe.flex.framework</groupId>
                <artifactId>framework</artifactId>
                <version>3.2.0.3958</version>
                <type>swc</type>
            </dependency>
            <dependency>
                <groupId>com.adobe.flex.framework</groupId>
                <artifactId>mx</artifactId>
                <version>4.5.0.19786</version>
                <type>pom</type>
            </dependency>
        </dependencies>
    
        <build>
            <sourceDirectory>src</sourceDirectory>
    
            <plugins>
                <plugin>
                    <groupId>org.sonatype.flexmojos</groupId>
                    <artifactId>flexmojos-maven-plugin</artifactId>
                    <version>3.8</version>
                    <extensions>true</extensions>
                    <configuration>
                        <sourceFile>Main.mxml</sourceFile>
                        <debug>true</debug>
                        <storepass/>
                    </configuration>
                    <dependencies>
                        <dependency>
                            <groupId>com.adobe.flex</groupId>
                            <artifactId>compiler</artifactId>
                            <version>3.2.0.3958</version>
                            <type>pom</type>
                        </dependency>
                    </dependencies>
                </plugin>
            </plugins>
    
        </build>
    
    </project>
    
    *Problem description:*
    
    Now I have got multiple other mxml application files under my 'src'
    directory, i.e. all mxml files under one single 'src' directory. How do I
    add them in above plugin, which only expects one single name in sourceFile
    configuration?
    
    *Things I have tried:*
    
    I tried copy-pasting multiple blocks of flexmojos-maven-plugin, and each of
    them having different sourceFile specified. However, that does not help,
    because maven just generates the final 'swf' file from the last block of
    flexmojos-maven-plugin. For eg. if first plugin block has sourceFile
    Main.mxml, and second plugin block has sourceFile Secondary1.mxml, then the
    'swf' will be generated for Secondary1.mxml only, not for Main.mxml.
    
    Also, I have tried adding following moduleFiles tag after the sourceFile
    tag:
    
    <moduleFiles>
         <module>Secondary1.mxml</module>
         <module>Secondary2.mxml</module>
         <module>Secondary3.mxml</module>
    </moduleFiles>
    
    Above generates total 4 swf files: one for the Main.mxml specified as
    'sourceFile', and 3 others for the Secondary mxml files specified under
    moduleFiles. However, only the swf generated for the Main.mxml actually
    works, and it has proper ~1mb size. Whereas, rest of the 3 swf files
    generated for moduleFiles are 100-200kb in size, and they are not opening in
    browser.
    
    *Help needed:*
    I have googed and posted my question on StackOverflow too, but no luck yet.
    Could you please provide any other suggestions to generate correct
    individual swf files for respective mxml files using single pom/maven build?
    
    
    
    --
    Sent from: http://apache-flex-development.2333347.n4.nabble.com/
    

Reply via email to