Creating New Java+Flex Project

  1. Create standard maven webapp using "mvn archetype:create -DgroupId=... -DartifactId=... -DarchetypeArtifactId=maven-archetype-webapp (optionally set build/finalName in pom.xml)
  2. Create following folders inside app/src: main/java, main/resources, main/flex, test/java, test/resources, main/webapp/flex
  3. run eclipse:eclipse and import the project to Eclipse/FlexBuilder
  4. Right-click on project and select "Flex Project Nature -> Add Flex Project Nature"
  5. Specify following settings using configuration wizard:
    • Application server type: None
    • Output folder: src\main\webapp\flex
  6. Switch to Flex perspective and fix project settings:
    1. "Project Properties" -> "Flex Build Path" -> "Main source folder" - enter "src/main/flex", Verify "Output folder" = "src\main\webapp\flex"
    2. Move main.mxml to src/main/flex
    3. "Project Properties" -> "Flex Applications" - add main.mxml
    4. "Project Properties" -> "Flex Compiler" - Uncheck "Generate HTML wrapper file"
  7. Edit pom.xml and add your dependencies and maven-jetty-plugin (in order to run embeded jetty container). See attached sample pom.xml
  8. If developing on Windows, extract webdefault.xml (see sample file attached) from jetty.jar, change useFilemappedBuffer=false, store it in src/main/resources and reference it in jetty config in pom.xml (see and for more details)
  9. Create wrapper HTML/JSP (Do it manually not using FB or ant tasks, since you may want to pass some params using flashvars, create HTTP session, etc.) See attached sample main-wrapper.jsp
  10. Copy playerProductInstall.swf and AC_OETags.js from Flex SDK installation into src/main/webapp/flex

Isaac Levin,
Jun 11, 2008, 2:34 PM
Isaac Levin,
Jun 11, 2008, 2:33 PM
Isaac Levin,
Jun 11, 2008, 2:35 PM