Saturday, August 8, 2009

.Net service bus maven project set up with JavaSDK

I am a big fan of maven, this article will show u how to create a maven project for the .net service bus.

SourceCode : http://shrimpysprojects.googlecode.com/files/DotNetServiceBusSubscriber.zip

Pre-required:

You have to go to this page:

http://jdotnetservices.sourceforge.net/download.html

make sure u have download everything they list, and configure you machine properly.


After you finishing everything listed in jdotnetservice, we can start now.


Step One: Create Empty Maven Jar Project


I am a Netbeans IDE user, coz it provide me friendly SVN and Maven support, but u can use what ever IDE you want, or even plain comman line to create a empty maven project.

I did not do any fancy stuff in here, all what i did is create a empty "Maven Quickstart Archetype" project.

And i name my project "DotNetServiceBusSubscriber". The name here is trivia, just because my following tutorial is going to illustrate how to use java application to connect to a C# application via .Net Service Bus, and my C# application is a publisher (coming soon ... :P ).


Step two: Change source version

By default, maven project is using java source version 1.3, we need to change them to a newer version, 1.5 or 1.6. It is up to you.

Right click on the project, choose Properties.

Select "Source" from the tree in the right hand side.
And change the source to 1.5 or 1.6.
Here i used 1.6.

Now go to your POM file, you will see someting like this:

PS: Hey how about i am not a NetBeans user, how can i generate this???

In this case, you have to manually type it into your POM file.....-_-!!!!


Step three: Dependency
I haven`t find any repository that provide ".Net Java SDK library" and all other jars that we need. So i decide to do all these by myself.

Speaking in the front: make sure u have download jdotnetservices-m3-ctp.zip , and metro. It will be better that u download jdotnetservices-m3-ctp_src.zip as well.

Edit your POM as show in the pic

Question: why some of the jar is specified as provided and some are 'compile'

Answer: coz some of the jar is in my classpath, so i said they are provided, but the others, i didn`t have them in my classpath, so set to compile.

NOW comes to the key point. All the dependency i specified here are fake, so we need to manually install all these jar.


In the pic showed how to install jar for JDotNetService, which is Java SDK for .Net service bus,
another three jar is from Metro. Do the same trick for them.

And do not forget install the source for JDotNetService. With source install, you can see the source code and java doc.


PS: Hey, how about i do not use Netbeans????

Maven - Guide to installing 3rd party JARs

This will help.

Final step: Do your coding

Now is time to create your own application ....have fun...

2 comments:

  1. cloudy, i really like your blog, waiting for this post.u r doing a great work by sharing your experience, nice buddy..

    ReplyDelete
  2. @shail2chouhan

    Haha..it is my pleasure....

    ReplyDelete