Add External Jar Maven Project

Add External Jar Maven Project

Sometimes while working on maven project all the jars which you want to include into your project will not be available on maven remote repository. It can be some external jars or custom jars created by you. To add this jars you could add its dependency as below:

  • Sample maven project:

Add External Jar Maven Project

  • Dependency details:
<dependency>
      <groupId>coherence</groupId>
      <artifactId>coherence</artifactId>
      <version>1.0.0</version>
      <scope>system</scope>
      <systemPath>${basedir}/src/main/webapp/WEB-INF/lib/coherence.jar</systemPath>
</dependency>
  • Complete pom.xml:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.javahonk</groupId>
  <artifactId>CoherenceJavaApplication</artifactId>
  <packaging>war</packaging>
  <version>0.0.1-SNAPSHOT</version>
  <name>CoherenceJavaApplication Maven Webapp</name>
  <url>http://maven.apache.org</url>
  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>coherence</groupId>
      <artifactId>coherence</artifactId>
      <version>1.0.0</version>
      <scope>system</scope>
      <systemPath>${basedir}/src/main/webapp/WEB-INF/lib/coherence.jar</systemPath>
    </dependency>
  </dependencies>
  <build>
    <finalName>CoherenceJavaApplication</finalName>
  </build>
</project>
  • For more details to add external or custom jars to maven project please visit here

Leave a Reply

Your email address will not be published. Required fields are marked *