solving javax.media problem

Be careful when we use directly 
<dependency>
  		<groupId>javax.media.jai</groupId>
  		<artifactId>jai-core</artifactId>
  		<version>1.1.3</version>
  	</dependency>
  	<dependency>
      <groupId>com.sun.media</groupId>
      <artifactId>jai-codec</artifactId>
      <version>1.1.3</version>
    </dependency>


it gives error depending on configuration of the machine. 
The solution is taken from 
http://stackoverflow.com/questions/1209583/using-java-advanced-imaging-with-maven