This can be done fairly easily. I'll outline the steps I use.
1. Create a directory named cocoon.
2. Do "svn co https://svn.apache.org/repos/asf/cocoon/branches/BRANCH_2_1_X/";. This will create a BRANCH_2_1_X subdirectory.
3. Build Cocoon.
4. Create an idea project in cocoon/BRANCH_2_1_X. Use that as the source directory. You can set the output path to cocoon/BRANCH_2_1_X/build/cocoon-2.1.7-dev/classes, but I don't thnk it matters much (I don't ever compile Cocoon in IntelliJ).
5. Open the project settings.
a. If you have installed and configured subversion then add it as the source control.
b. In Paths select the libraries tab.
c. Click on add jars.
d. Select all the jars in lib/core and lib/optional and add them.
e. Back under paths mark the build directory as excluded (this speeds things up a bit). You can also exclude other non-source stuff if you want.


6. Select Run/Edit Configurations.
a. Select the Remote tab.
b. enter a name ("Cocoon" works).
7. export JPDA_OPTS to match the arguments shown in the IntelliJ window.
8. Set some breakpoints. 9. Open the debug window for the "Cocoon" task you just created.
10. Start tomcat using "catalina.sh jpda start".
11. Start the debug task in IntelliJ.


Now everytime you want to debug you only need to do steps 8-11.

This works whether you are running Cocoon in Tomcat, Weblogic or something else. You just have to make sure the JVM Cocoon runs in has the remote options that IntelliJ tells you to set.

If you want to be able to build Cocoon inside of IntelliJ you should be able to set up build.sh as an external task to run. Another option would be to modify Cocoon's build to build a module for each block, but I'll convert the build to use maven before I'd bother with that. Then I could just do "maven idea:multiproject".

HTH,
Ralph



Hugo Burm wrote:

Hello Ralph,

Can you comment on how you debug Cocoon with IDEA (isn't IntelliJ/Jetbrains
the name of the company?)? Can you set breakpoints and step through  the
code?
Just for your reference, this is how I debug a Cocoon block:
Have to do this one time:
- Build the whole Cocoon thing with Ant (the default build) and deploy it.
- Remove the jar of the block from WEB-INF/lib
- Create an IDEA project, set the src dir to the src dir of the block. Set
the output dir to WEB-INF/classes.
And repeat this many times:
- Modify some code . Add some print statements
- Compile
- Restart the container (Tomcat)
- Test the result in a browser (and check the print statements)

This is brain damaged (debugging source code with print statements while we
are living in 2005). So any comments on how I can improve this workflow is
appreciated.

Hugo Burm, also a big fan of IDEA by the way

BTW, I bought a personal license for IDEA. IntelliJ/Jetbrains offer these
licenses mostly during a short period at 50%.





Reply via email to