我有一個相當簡單的Flex SWC模塊,它是通過Maven Flexmojos插件編譯的。此模塊還在生成源階段使用flexmojos:generate目標創建與我的Java服務&域類相當的Actionscript3。常規來源位於src/main/flex
,生成的來源位於src/main/flex-generated
。生成的源不會被檢入到Subversion中。像許多其他flexmojos用戶一樣,我使用build-helper:添加源代碼目標將第二個源代碼樹添加到我的編譯中。這已經好幾個月了運作良好和Maven的輸出通常是這樣的:Maven發佈:執行似乎打破構建幫手:添加源
[INFO] ------------------------------------------------------------------------
[INFO] Building myproj Core Client -- Flex Service
[INFO] task-segment: [deploy]
[INFO] ------------------------------------------------------------------------
[INFO] [flexmojos:generate {execution: create-actionscript-classes}]
[INFO] Flexmojos 3.7.1
[INFO] Apache License - Version 2.0 (NO WARRANTY) - See COPYRIGHT file
[INFO] flexmojos 3.7.1 - GNU GPL License (NO WARRANTY) - See COPYRIGHT file
[INFO] Calling the generator for each Java class.
[INFO] Generating: /home/bsmith/develop/myproj/myproj-core/tags/myproj-core-1.0.2/flex-service/src/main/flex-generated/com/myprojvision/core/domain/security/Group.as
.......
[INFO] [build-helper:add-source {execution: add-source}]
[INFO] Source directory: /home/bsmith/develop/myproj/myproj-core/tags/myproj-core-1.0.2/flex-service/src/main/flex-generated added.
[INFO] Flex compiler configurations:
.....
-compiler.source-path /home/bsmith/develop/myproj/myproj-core/tags/myproj-core-1.0.2/flex-service/src/main/flex /home/bsmith/develop/myproj/myproj-core/tags/myproj-core-1.0.2/flex-service/src/main/flex
注意如何很好的Flex編譯器的源路徑既是源目錄。此設置將成功打包,安裝和部署SWC工件。但是,現在我們希望使用Maven發行版插件來自動發佈過程。 release:prepare
目標運行良好。然而,釋放:因爲Flex編譯器不會交給生成的源目錄一些未知的原因進行目標失敗:
[INFO] [INFO] ------------------------------------------------------------------------
[INFO] [INFO] Building myproj Core Client -- Flex Service
[INFO] [INFO] task-segment: [deploy]
[INFO] [INFO] ------------------------------------------------------------------------
[INFO] [INFO] [flexmojos:generate {execution: create-actionscript-classes}]
[INFO] [INFO] Flexmojos 3.7.1
[INFO] [INFO] Apache License - Version 2.0 (NO WARRANTY) - See COPYRIGHT file
[INFO] [INFO] Calling the generator for each Java class.
[INFO] [INFO] Generating: /home/bsmith/develop/myproj/myproj-core/trunk/target/checkout/flex-service/src/main/flex-generated/com/myprojvision/core/domain/security/Group.as
...
[INFO] [INFO] [build-helper:add-source {execution: add-source}]
[INFO] [INFO] Source directory: /home/bsmith/develop/myproj/myproj-core/trunk/target/checkout/flex-service/src/main/flex-generated added.
...
[INFO] [INFO] Flex compiler configurations:
[INFO] -compiler.source-path /home/bsmith/develop/myproj/myproj-core/trunk/target/checkout/flex-service/src/main/flex
注意的是,文件是在正確的地方產生的建立幫助正確調用,但flex compiler.source-path缺少生成的源目錄,因此產生了Flex類未發現的錯誤。這個問題對我來說太神奇了,這個版本是這樣的:prepare在分叉的Maven生命週期中做一個[clean,verify]並且它可以工作,但是release:perform不......所以它似乎並不是它的叉是這個問題。
這裏是構建輔助插件的配置:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
<id>add-source</id>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>${project.basedir}/src/main/flex-generated</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
需要注意的是,如果我溝構建輔助插件,並使用flexmojo的sourcePaths配置,然後一切工作正常。
<sourcePaths>
<path>${project.basedir}/src/main/flex</path>
<path>${project.basedir}/src/main/flex-generated</path>
</sourcePaths>
但是sourcePaths已被棄用,前鋒爲那些與多個柔性源代碼樹的方法是建立輔助。