Integrating Flex and Java in an Eclipse Web App Project
Requirements
1. Eclipse Web Tools Platform (WTP) from http://www.eclipse.org/webtools/, specifically the Web Standard Tools (WST) is used in this tutorial.
2. Flex 2 Builder Eclipse Plug-In from http://www.adobe.com/products/flex/flexbuilder/
Create the Eclipse Web App Project
1. Create a new project as “Web > Dynamic Web Projectâ€.
2. Give it a descriptive project name.
3. Uncheck “Use default†and set “Directory†to the root directory where the project files are kept. (See related blog Directory Structure for Integrated Flex and Java Web Applications.)
4. Click “Nextâ€.
5. On “Project Facets†screen click “Nextâ€.
6. On “Web Module†screen set “Context Rootâ€.
7. Set “Content Directory†to the root location of web files and WEB-INF folder.
8. Set “Java Source Directory†to the root location of web related java source (e.g. struts actions).
9. Click “Finishâ€
10. See blog Maven Build with Eclipse for optional steps.
Add Flex Project Nature
1. Right click newly created project.
2. Select “Flex Project Nature†> “Add Flex Project Natureâ€
3. Open the “Flex Development†perspective (Window > Open Perspective)
4. Open project properties (Right click project and select “Propertiesâ€).
5. Select “Flex Build Pathâ€.
6. Set “Main source folder†to the root directory where mxml and action script files are.
7. Optionally set the “Output folder†to “.output\flex2†(see blog Maven Build with Eclipse and Directory Structure for Integrated Flex and Java Web Applications).
8. Select “Flex Applicationsâ€.
9. Add all flex applications (root level mxml files, those that contain the Application root tag).
10. Click “Set as Default†for one of the applications.
11. Remove auto created flex applications that you don’t need.
12. Unless compiling mxml on server, open project properties > “Flex Compiler†and uncheck “Generate HTML wrapper file†as this creates a possibly unneeded html-templates folder
13. See blog on Maven Build with Eclipse for optional steps.
08.15.06
by Steve Gudmundson