I have a Flex/Java web application that uses Maven as a build tool. Currently, if I want to debug the entire application I use Maven to create the WAR file and use the carg
We are using Flash Builder but this should work for the eclipse plugin too. In the Flex Build Path configuration for the project set the output folder to the target folder where you have your web server pick up the SWF you are building. Set the Output folder URL to point to the context that launches the SWF and you should be good to go. Example:
Output folder: c:\java\tomcat\webapps\myapp
Output folder URL: http://localhost:8080/myapp
As an aside we have also found that using IE to test in makes things simpler as it tends to have less funnies with cached SWFs then Firefox or Chrome.
I'm using FlashBuilder with the WTP plugin..I'm using the same environment for both Flex and Java. As an application server I'm using Tomcat for the moment, and I configured the output folder like that:
${DOCUMENTS}.metadata.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\myproject
Where DOCUMENTS is a linked variable and represents the full path to my workspace: C:\projects\workspace-mypetprojects
Everything goes well, I do not have to restart the server or to build a new war when modifying the flex files.
First of all you should download Eclipse for Java EE developers* and install Flash Builder as a plugin, pointing to your existing Eclipse, during installation. Having that you should be able to create Flex project through
File -> New -> Other -> Flex Builder -> Flex Project
Here you need to set Application server type
to J2EE and make sure you have Create combined Java/Flex...
option checked. I usually leave Use remote object access service
option unchecked as I'm using GraniteDS so it's up to you if you need it or not.
On the next screen you need to configure your Application Server. Here are the steps for Tomcat:
Target runtime -> New -> Apache -> <<your preferable Tomcat version>>
(change server name and host name to whatever suits you best or - my favorite :) - leave it as it is)C:\Program Files\Apache Software Foundation\Tomcat 6.0
. If you don't have Tomcat installed you can do so by using Download and install
wizardFinish
.Window -> Show view -> Other -> Server -> Servers -> OK
will open servers view where you can manage your Tomcat server. Use RMB on your server name, then Add and remove
, select your application, click Add
and Finish
.
Now, 3 icons above the server name and to the right are used to start the server, starting from the left, in debug, normal and profiling mode. Press debug one and server should start - now you will be able to debug Java code you put on the server.
Last step is to start Flex app in debug mode. Below menu bar you can see icons similar to those used to start the server. Press the down arrow located near debug one and select Debug configurations
. Double-click Flex Application
, change the name of your newly created configuration and correct debug URL to match your server configuration (leave it as it is if you left everything default up to now). Press Apply
and Debug
and here you are debugging :) Use F5 to step into, F6 to step over and F8 to continue.
PS: You may want to change default browser your application is started in (by default it is in-built Eclipse browser I think). You do that by going to Window -> Preferences -> General -> Web Browser
.
Happy debugging :)
* unfortunatelly I'm using older version of the IDE so above steps may be slightly different than what you have in your Eclipse but you should get general idea. Also Flex Builder 3 seems to be incompatible with latest Eclipse releases (Flex Projects are not fond of being created in Helios release)