Tuesday 25 March 2008

Maven Webapps debug with Eclipse and Tomcat

I like using Maven. I also like using Step-Trace-Debugging. So here is what I do to accomplish this using Tomcat, Maven and Eclipse.

Required:
Steps:
  • Create or Import your maven project into Eclipse
  • Select File > Properties for this project
  • Select the Tomcat property
  • Check the box "Is a Tomcat Project"
  • Enter the context name. For my example, dcmdb
  • Click Apply
  • Go to /conf/Catalina/localhost and edit the context file i.e. dcmdb.xml.
    • Edit the docBase and workDir to point to the location of your maven project
    • Notice that the docbase should point to ../dcmdb/target/dcmdb-1.0 where
      • ../dcmdb = the location of my maven project
      • ../target/ = the directory that is created when using the maven package command
      • ../dcmdcb-1.0 = the directory that is my artifact name. It's the webapp
  • The final step involves changing the Java Build Path property in Eclipse by pointing the source output to /target/dcmdb-1.0/WEB-INF/classes. This means that once you make a change to your code all you need to do is restart tomcat.

Saturday 8 March 2008

Learning Ruby on Rails 2.0

I have finally made some time to start learning Ruby on Rails. Here's my story:

Downloading and installing
Well at home I am running windows on a laptop with busted keys. Because one of my offspring keeps ripping keys from the keyboard. The latest victims are the spacebar and the "n" key. Sad but true. So I am a little lazy at times I so installed instant rails: http://instantrails.rubyforge.org/wiki/wiki.pl

Finding a suitable tutorial
I then discovered that there is a difference between Rails 2.0 and 1.x. But Rails 2.0 tutorials seem hard to come by (well again if Google does not produce on the first page ... then it's hard to find :)

Ones that I did find and am working through:
Will update as I go.