maven with flex
DESCRIPTION
Automating the build process for a flex application. You swf,ie the target now is sent to the web application and a war is generated through the build processTRANSCRIPT
![Page 1: Maven with Flex](https://reader035.vdocuments.site/reader035/viewer/2022062312/55512612b4c905f1528b4828/html5/thumbnails/1.jpg)
![Page 2: Maven with Flex](https://reader035.vdocuments.site/reader035/viewer/2022062312/55512612b4c905f1528b4828/html5/thumbnails/2.jpg)
Maven, a Yiddish word meaning accumulator of knowledge.
Maven is a tool that provides an uniform and easy build process for your projects› you describe your project in one xml file
and Maven reads this information to compile and package your project.
![Page 3: Maven with Flex](https://reader035.vdocuments.site/reader035/viewer/2022062312/55512612b4c905f1528b4828/html5/thumbnails/3.jpg)
Maven essentially is Project Management and comprehension tool allows you to do,› Continuous Integration› Builds› Testing› Dependencies› Documentation› Distribution › Reporting etc..
![Page 4: Maven with Flex](https://reader035.vdocuments.site/reader035/viewer/2022062312/55512612b4c905f1528b4828/html5/thumbnails/4.jpg)
It comes with default templates that are Widely adopted as the best practices
Convention over configuration Get everything on-demand from their
repositories› All the plugins required for your build are
taken from a common repository and put into your local repository
![Page 5: Maven with Flex](https://reader035.vdocuments.site/reader035/viewer/2022062312/55512612b4c905f1528b4828/html5/thumbnails/5.jpg)
The basic concept of Maven is a project Any directory that has a project.xml in it is
a project. Another concept in Maven is that of a repository
The repository holds the artifacts (a jar, swf, swc, war, pom etc) on which your project depends. There are two kinds of repository: local and remote
The local repository is created in a special directory called ".maven/repository". In Windows, this directory is created in C:\Documents And Settings\<username>\.m2
![Page 6: Maven with Flex](https://reader035.vdocuments.site/reader035/viewer/2022062312/55512612b4c905f1528b4828/html5/thumbnails/6.jpg)
Instead of each project having its own copies of third party libraries, the repository helps developers across projects to share the libraries.
Each project can also in turn generate its artifacts and publish it into the remote repository. The process of publishing a jar into the repository is called "install" in Maven lingo.
![Page 7: Maven with Flex](https://reader035.vdocuments.site/reader035/viewer/2022062312/55512612b4c905f1528b4828/html5/thumbnails/7.jpg)
![Page 8: Maven with Flex](https://reader035.vdocuments.site/reader035/viewer/2022062312/55512612b4c905f1528b4828/html5/thumbnails/8.jpg)
The project.xml is divided into four main parts namely› Project Management Section.› Project Dependency Section.› Project Build Section› Project Reports Section.
![Page 9: Maven with Flex](https://reader035.vdocuments.site/reader035/viewer/2022062312/55512612b4c905f1528b4828/html5/thumbnails/9.jpg)
![Page 10: Maven with Flex](https://reader035.vdocuments.site/reader035/viewer/2022062312/55512612b4c905f1528b4828/html5/thumbnails/10.jpg)
Has general information on the organization, its web site, project web site, location of SCM, deployment and issue tracking site, developer list, mailing lists to name a few.
![Page 11: Maven with Flex](https://reader035.vdocuments.site/reader035/viewer/2022062312/55512612b4c905f1528b4828/html5/thumbnails/11.jpg)
Describes the location of source, test and resource files
![Page 12: Maven with Flex](https://reader035.vdocuments.site/reader035/viewer/2022062312/55512612b4c905f1528b4828/html5/thumbnails/12.jpg)
The target audience of the reports can vary from other developers in the same project to sponsors, stakeholders or users from other projects
![Page 13: Maven with Flex](https://reader035.vdocuments.site/reader035/viewer/2022062312/55512612b4c905f1528b4828/html5/thumbnails/13.jpg)
Key to every project For eg. If you want your Junit Test cases
to run you need a junit “jar” file. For this you need to specify a <dependency> tag, that describes your artifact.
![Page 14: Maven with Flex](https://reader035.vdocuments.site/reader035/viewer/2022062312/55512612b4c905f1528b4828/html5/thumbnails/14.jpg)
Let build a flex project which uses› Cairngorm› BlazeDS› Locale for Internationalization
![Page 15: Maven with Flex](https://reader035.vdocuments.site/reader035/viewer/2022062312/55512612b4c905f1528b4828/html5/thumbnails/15.jpg)
Install Cairngorm SWC into our local repository (Optional). If it (Maven repository) does not find it in their remote repository
mvn install:install-file –Dfile=Cairngorm.swc –Dpackaging=swc –Dversion=2.2.1 –DgroupId=com.adobe.cairngorm -DartifactId=cairngorm
![Page 16: Maven with Flex](https://reader035.vdocuments.site/reader035/viewer/2022062312/55512612b4c905f1528b4828/html5/thumbnails/16.jpg)
mvn archetype:create -DarchetypeGroupId=org.apache.maven.archetypes -DarchetypeArtifactId=maven-archetype-quickstart -DgroupId=com.companyname.module -DartifactId=modulename-DpackageName=com.companyname.module -Dversion=1.0
![Page 17: Maven with Flex](https://reader035.vdocuments.site/reader035/viewer/2022062312/55512612b4c905f1528b4828/html5/thumbnails/17.jpg)
mvn archetype:create -DarchetypeArtifactId=maven-archetype-flex -DarchetypeVersion=1.0 -DarchetypeGroupId=dk.jacobve.maven.archetypes -DgroupId=com.companyname.module -DartifactId=moduleFlex -DpackageName=com.companyname.module –Dversion=1.0
![Page 18: Maven with Flex](https://reader035.vdocuments.site/reader035/viewer/2022062312/55512612b4c905f1528b4828/html5/thumbnails/18.jpg)
This would generate the war and the contents would be copied from the flex application
mvn archetype:create -DarchetypeGroupId=org.apache.maven.archetypes -DarchetypeArtifactId=maven-archetype-webapp -DgroupId=com.companyname.module -DartifactId=moduleWeb -DpackageName=com.companyname.module -Dversion=1.0
![Page 19: Maven with Flex](https://reader035.vdocuments.site/reader035/viewer/2022062312/55512612b4c905f1528b4828/html5/thumbnails/19.jpg)
Copy the following <project
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.companyname.module</groupId><artifactId>module</artifactId><packaging>pom</packaging><version>1.0</version><name>module</name><url>http://maven.apache.org</url><modules><module>../moduleFlex</module><module>../moduleWeb</module></module>
![Page 20: Maven with Flex](https://reader035.vdocuments.site/reader035/viewer/2022062312/55512612b4c905f1528b4828/html5/thumbnails/20.jpg)
<project 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.companyname.module</groupId> <artifactId>moduleFlex</artifactId> <packaging>swf</packaging> <version>1.0-SNAPSHOT</version> <name>multiModuleProjectArtifactIdFlex Maven Flex</name> <url>http://maven.apache.org</url> − <properties> − <flex.home>${env.FLEX_HOME} </flex.home> </properties> − <build> <sourceDirectory>src/main/flex</sourceDirectory> − <plugins> − <plugin> <groupId>net.israfil.mojo</groupId> <artifactId>maven-flex2-plugin</artifactId> <extensions>true</extensions> − <configuration> <flexHome>${flex.home}</flexHome> <useNetwork>true</useNetwork> <main>Main.mxml</main> <!-- For including the locale folder into our application --> <extraParameters> <parameter> <name>compiler.source-path</name> <values> <value>${basedir}/locale</value> </values> </parameter> </extraParameters> </configuration> </plugin> </plugins> <defaultGoal>install</defaultGoal> </build> </project>
![Page 21: Maven with Flex](https://reader035.vdocuments.site/reader035/viewer/2022062312/55512612b4c905f1528b4828/html5/thumbnails/21.jpg)
Go to your Parent module project Open cmd and go to the parent project
folder› Mvn install› Should copy the details and you should
have your first flex application build with
![Page 22: Maven with Flex](https://reader035.vdocuments.site/reader035/viewer/2022062312/55512612b4c905f1528b4828/html5/thumbnails/22.jpg)
Hope you find this information helpful Comment/Contact me on
[email protected] Download Maven 2 from
http://maven.apache.org/download.html For basics on Maven read
› http://www.theserverside.com/tt/articles/article.tss?l=MavenMagic