当使用maven管理Flex项目结构时,flex-mojo毫无疑问是首选的maven插件,(貌似也没啥第二选择)。
实际使用中碰到一个问题,在这里记录下来,也许能帮到其它人。
如果你的项目中编译时报错:“Source file was not defined, flexmojos will guess one.” 请尝试:
在flex项目下的pom文件中,加入<sourceFile>属性,(红色标出部分)
<plugins>
<plugin>
<groupId>org.sonatype.flexmojos</groupId>
<artifactId>flexmojos-maven-plugin</artifactId>
<version>3.2.0</version>
<extensions>true</extensions>
<configuration>
<sourceFile>Main.mxml</sourceFile>
<output>xxxx.swf</output>
<services>xxxx/services-config.xml</services>
<contextRoot>/xxxx</contextRoot>
<locales>
<locale>en_US</locale>
</locales>
</configuration>
</plugin>
</plugins>
请根据你的主应用程序的名字更改红色部分.
PS: 我这里出现这个问题的原因是,在配置的sourceDirectory下,有多个.mxml是以<mx:Application>开头的,导致flex-mojo无法确认编译时的入口点。当然也可能有其他的原因会导致这个问题。