+ All Categories
Home > Technology > Maven with Flex

Maven with Flex

Date post: 13-May-2015
Category:
Upload: priyank
View: 2,844 times
Download: 0 times
Share this document with a friend
Popular Tags:
22
Transcript
Page 1: Maven with Flex
Page 2: Maven with Flex

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

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

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

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

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
Page 8: Maven with Flex

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
Page 10: Maven with Flex

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

Describes the location of source, test and resource files

Page 12: Maven with Flex

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

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

Let build a flex project which uses› Cairngorm› BlazeDS› Locale for Internationalization

Page 15: Maven with Flex

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

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

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

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

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

<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

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

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


Recommended