Add external jar in pom.xml

Option 1: Copy jar in local repo

Under dependencies section, add following block.
<dependency>

<!– groupId – 0 level directory name = you may give any name –>
<groupId>custom</groupId>

<!– artifactId- 1 level sub directory name =  should be name of the jar without version number –>
<artifactId>simplecaptcha</artifactId>

<!– version- 2 level sub directory name = jar version mentioned in jar file name –>

<version>1.2.1</version>

</dependency>

Under C:\Users\<username>\.m2\repository

  • Create directory with name as value you have given in  <groupId></groupId>
    • Go into this directory
    • Create directory with name as value you have given in  <artifactId></artifactId>
      • Go into this directory
      • Create directory with name as value you have given in  <version></version>
        • Copy your jar here

Example:

My file is stored here:

C:\Users\<username>\.m2\repository\custom\simplecaptcha\1.2.1\simplecaptcha-1.2.1.jar

 

 

Option 2: Use system scope

Example:

<!– Hibernate –>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>4.3.6.Final</version>
<scope>system</scope>
<systemPath>G:/Setups/hibernate-release-4.3.6.Final/hibernate-release-4.3.6.Final/lib/required/hibernate-core-4.3.6.Final.jar</systemPath>
</dependency>