Friday, June 27, 2008

Import Apache Qpid in to Intellij Idea

During last couple of days I was struggling to import Apache Qpid java in to Idea (Intellij Idea) and start the broker with Idea.My main target was to debug the broker using Idea. But there were few modifications to be done.I thought this will be useful for the people who are new to Qpid.

1. First build the Apache Qpid java using following commands or please refer to the how to build in Apache Qpid.
  • mvn -Pfastinstall
  • cd distribution
  • mvn (This will create all the artifacts )
  • tar -xzvf target/qpid-1.0-incubating-M3-SNAPSHOT-java-bin.tar.gz
In here the file name is depend on the version of the Qpid you are using, somehow you have to extract java binary.Then navigate to the extracted directory and set the QPID_HOME variable to that directory.
Now you are in a possition of running Qpid in commandline so you can try this out by following command.
  • $QPID_HOME/bin/qpid-server
Now come back to importing in to Idea. Go back to the source folder of Qpid java and run the this command inorder to build the Idea project.
mvn idea:idea
This will create an Idea project so you can open the project using Idea but the problem is you won't be able to run the java broker on Idea and you won't be able to debug the broker. So in order to make it happen you have to do several modifications. First we have to hardcode the Qpidhome, although we have already set the environment variable it's unable to access them when we start the broker using Idea.
Please have a look in to following diff files and you'll get to know how to do those modifications. diff files.
When you do modifictaion don't apply the patch directly please have a look and do the modifications according to your installation which means your Qpidhome is different from my one.After doing three of those modifications compile the project in Idea and run it, It will work. If this doesn't work for you please be kind enough to comment on this post.

Thanks

2 comments :

ritchiem said...

I always just set the VM Parameter in Intelij -DQPID_HOME=[full path to qpid checkout]/qpid/java/broker

Then run the Main class.

lahiru said...

Sure it's easy :),
I didn't know that when I ask that question from the list somebody told me that I'm suppose to change the source so I found a way to do that by changing the source.

Thanks Martin