Initial data:
- Flex project 100k + lines
- 6 swc modules, assembled into one swf
- FlexSDK 4.9. * + Flexmojos 4.2-beta
It was decided that it was time to update the project and go to the latest (at the time of writing) FlexSDK 4.14.
I would like to immediately note that options other than Flexmojos were not considered, since the project was already working on it and was not interested in a completely new solution.
So, first we had to decide which version to use.
The list of versions on the site of the plugin contained versions: 6 (some documentation) and 7 (blank page with documentation).
Also on the
github / flexmojos page is a list of brunches where you could see when which brunch was updated.
Despite the fact that the last brunch marked “stable” was flexmojos-6.x, it was decided to use flexmojos-7.x, since it is being actively worked on in contrast to previous versions.
')
Test project setup
Step # 1
Installing FlexSDK
On the
apache.flex website
, select the SDK, download, install.
Step 2
Mavenization FlexSDK
This is done using flex-utilites.
> git clone https://git-wip-us.apache.org/repos/asf/flex-utilities.git > cd mavenizer > mvn package
A lot of step-by-step instructions were found, but almost all of them were old and the steps described in them did not work. The most recent instruction was found on the
ApacheFlex \ SDKUtilites website . One of the steps inside
Building the Mavenizer was the
Checkout the “develop” branch. Do not do this. Inside the develop branch there are no .pom files and there is nothing there.
Next, do everything that is indicated in the
Using the Mavenizer section.ImportantRight team
> java -jar [home]/core/target/flex-sdk-converter-1.0.0-SNAPSHOT.jar "[sdkhome]" "[fdktarget]"
Wrong team
> java -cp target/flex-sdk-converter-1.0.jar SDKGenerator "{sdkhome}" "{fdktarget}"
Almost all articles contained commands that used the / target path (without / core) and the SDKGenerator - this is all wrong.
As a result, the files from the folder with the manned SDK are copied to the local maven repository.
> mv {fdktarget} {mavenpath}/.m2/repository
Step 3
Project Setup
First, create an empty project.
> mvn archetype:generate -DarchetypeGroupId=net.flexmojos.oss -DarchetypeArtifactId=flexmojos-archetypes-application -DarchetypeVersion=7.0.1
Let's open pom.xml and change the versions we don't need.
In several places (version can be checked in maven repositories)
<version>4.14.1.20150325</version>
Update playerglobal version
<groupId>com.adobe.flash.framework</groupId> <artifactId>playerglobal</artifactId> <version>16.0</version>
Add repositories for FlexUnit
<repositories> <repository> <id>flex-mojos-repository</id> <url>http://oss.sonatype.org/content/repositories/releases</url> <releases> <enabled>true</enabled> </releases> <snapshots> <enabled>false</enabled> </snapshots> </repository> </repositories> <pluginRepositories> <pluginRepository> <id>flex-mojos-plugin-repository</id> <url>http://oss.sonatype.org/content/repositories/releases</url> <releases> <enabled>true</enabled> </releases> <snapshots> <enabled>false</enabled> </snapshots> </pluginRepository> </pluginRepositories>
Check if the compilation works:
> mvn clean compile
Run the .swf from the / target folder. It should display
Hello World!Is done.
An example of a working project containing the swc library assembly and applications can be viewed on
github / flex-maven-demo .
Useful links:
- habrahabr.ru/post/178997 - a comparison of several options for building in maven
- flexmojos.atlassian.net/wiki/display/FLEXMOJOS/Home - wiki by flexmojos