Adding a Flex Nature to an existent Java (WTP) project

Sometimes you already have a J2EE project (made with WTP) and you want to be able to make it also a Flex project. Probably you don’t like the idea of creating a new Java/Flex project and copy the files. Neither do I :D (If you want to create a new Java/Flex project then check my previous posts about creating a Java/Flex project and debugging this project).

Fortunately the solution is there in Flex Builder. You need to select the project in project explorer and right click to bring up the contextual menu for the project. Then you should select Flex Project Nature > Add Flex Project Nature:

Selecting this command will open a wizard that looks like the one for creating a new Flex project (the differences are that some options are disabled as the project already exists and you are just adding new things to it). So here is the first page and you can see you have the option to choose if you want to use LiveCycle Data Services / BlazeDS or not. On the second page you can enter the path for Flex WAR file (if you choose remote object access on first page). Click “Finish” and you got yourself a Java/Flex combined project.

Final words

I will not lie to you, these two features (combined Java/Flex project and Add Flex Nature) are very dear to me as I was the engineer who worked on them for Flex Builder 3 :) But besides the sweet memories and countless meetings to shape up these wizards and endless fights with my quality engineer on what should happen, I had another reason to write my first technical post on this subject: I talked in the last couple of months with Java developers who work with Flex and they didn’t know about these features yet :(

So, I am really curious if you guys find this helpful or not and if there are other things you still need (I have friends inside Flex Builder team so we can push our wishes :) ).

Comments

7 Responses to “Adding a Flex Nature to an existent Java (WTP) project”

  1. Brian on June 18th, 2008 5:35 pm

    We have used WTP with flexbuilder, however, it has been very bugy for us. For example, when I do a flex build, the tomcat WTP server does an automatic restart, even though no java class files changed. This causes BlazeDS is reload and causes NOP Logging errors for log4j. Have you experienced any of these problems?

  2. Mihai Corlan on June 18th, 2008 7:11 pm

    Hi Brian,

    No, this is the first time I’ve heard about this.
    I have just tried this scenario:
    1. Create a Java (WTP) Flex project with LCDS
    2. Starts the Tomcat Server from Eclipse with the project deployed on it
    3. Change in the MXML file a tag and Save the file
    I couldn’t see any restart of the server

    Do you have an easy way to try to reproduce it on my computer or can you post somewhere a project that I can download and try to see if I can reproduce it?

  3. Brian on June 18th, 2008 10:45 pm

    Open up {your project}/.settings/org.eclipse.wst.common.component and add this line to the mix:

    This line seems to be causing the problem in the test project. If you have that line, everytime you save a file your wtp server thinks it needs to republish itself! See if it happens to you? However, in our real project we don’t have anything like this in that file, yet it tries to republish. With BlazeDS, the reload time is painful because it has to recache everything.

  4. Brian on June 18th, 2008 10:47 pm

    Sorry, it appears you have a filter on opening/closing tags:

    wb-resource deploy-path=”/” source-path=”/flex_src”/

  5. Mihai Corlan on June 19th, 2008 5:50 pm

    This line is also in my config file. If you have some steps to reproduce it you should log a bug here: https://bugs.adobe.com/flex/

    I have tested again on my machine and I couldn’t find any issue. But if you manage to resolve the issue you could safely remove that line.

  6. Sorin cyron on July 29th, 2008 11:36 am

    Hello

    I have a java web project in eclipse that i have deployed to a war file.In the flex project i am using this war file.

    I alternatively write code both in eclipse and flex and i must export to war file every time i modify in eclipse.

    My question is: is there a method to autodeploy to the war file when i modify the java code in eclipse so that the flex builder will see it?

    Thanks in advance

  7. Mihai Corlan on July 30th, 2008 2:55 pm

    @Sorin

    Right now I don’t see a solution for what you need. But, I am curious why is not OK for you to create Flex and Java Web Project and work on both Java and Flex files from within the same project? This kind of setup it should solve your problem, I think.

Leave a Reply