Thursday, September 4, 2008

Adding LinkedIn to Your Blogspot

Ok here's how to get it done

1. Go to the Layout Tab, and open 'Edit HTML' section

2.Find for the <data:post.body/> tag

3.Paste this just above the tag

<div style='float:right; margin-left:10px;'>

<a href=''><img alt='View Your Profile's profile on LinkedIn' border='0' height='15' src='' width='80'/></a>


You have different image formats available at linked in so you can pic the one of your choice and put it instead of the one I have used (between the <div> and </div> tags).
Of course you have to change your profile to your name :-D

Tuesday, August 26, 2008

More on Maven

Well if you don't really like ant for some reason

Quick Facts

Adding Plugin to Project

Add the following to your POM


Adding Extensions

This is requiered to ensure the correct driver for the databse you are using is available to the plugin. I am using MySQL for example for other databses you have to mention there respective driver jar.









Plugin Goals

  • hibernate3:hbmtemplate Generic exporter that can be controlled by a user provided template or class.
  • hibernate3:hbm2cfgxml Generates hibernate.cfg.xml
  • hibernate3:hbm2dao Base class for the different hibernate3 goals based on the Ant tasks of hibernate tools.
  • hibernate3:hbm2ddl Generates database schema.
  • hibernate3:hbm2doc Generates HTML documentation for the database schema.
  • hibernate3:hbm2hbmxml Generates a set of hbm.xml files.
  • hibernate3:hbm2java Generates Java classes from set of *.hbm.xml files.


Run the following command from command line(ensure you use the complete plugin name)

mvn org.codehaus.mojo:hibernate3-maven-plugin:2.1:hbm2ddl

Jetty-Maven-Eclipse ... mmmmm nice

Here's on how to setup jetty:run goal for a maven project, and to run it from eclipse.

Configure Jetty in project's pom.xml

The first step is to add maven-jetty-plugin to you project's pom.xml. Here is n extract from my sample project.


No rocket science here, the configuration tag defines the configuration for your specific needs i will elaborate it a little later.

  • <scanIntervalSeconds> tag defines the interval after which the plugin will 'scan' all resources in 'webb-application' base directory for changes. Good option if you will be editing your JSPs or VMs(velocity!) on the fly while developing and want to see immediate results.
  • <jettyEnvXml> tag defines the XML where you configure environment properties for Jetty. For example 'propertyhosts' and JNDI data-sources etc
  • <webApp> tag points to the 'exploded' webapp created by maven install goal in your eclipse project.

Adding Dependencies

If needed you can add dependencies 'selectively' toyour pom so that they apply only on the jetty configuration. Here's how to do that



The dependencies tag should be nested within the plugin tag.

The Jetty Environmental Config

Environmental resources such as JNDI names etc for datasources can be configured in a file pointed by the < jettyEnv > tag. In my sample I configure a propertyhost and a datasource. Following is the complete xml file

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "">
<Configure class="org.mortbay.jetty.webapp.WebAppContext">
<New class="">
<Arg type="java.lang.String">localhost:22081/</Arg>

<New id="webmeet" class="">
<New class="oracle.jdbc.pool.OracleConnectionPoolDataSource">
<Set name="Password">password</Set>
<Set name="User">appuser</Set>
<Set name="URL">

To run this from command line run following command from the maven project root

mvn jetty:run  

Running from Eclipse

Eclipse 3.3.X Europa

  • Choose Run > Open Run Dialog.
  • Select Maven Build and click on add new configuration button
  • Give the configuration a name
  • Add goal jetty:run
  • If you want to use log4j instead of the sl4j provided by jetty add the following in the WM argson the JRE tab
    -Dslf4j=false -Dlog4j.configuration=file:path/to/
  • Click 'Apply' and click 'Run' to run the webapp in Jetty.

Eclipse 3.2.X Callisto

The steps are same as above except that you have to choose Run > External Tools > Open External Tool Dialog in the first step.