EN
Maven - import local jar to project
6 points
Quick solution:
xxxxxxxxxx
1
<dependency>
2
<groupId>com.example</groupId>
3
<artifactId>example-name</artifactId>
4
<version>1.0</version>
5
<scope>system</scope>
6
<systemPath>${project.basedir}/external_libs/MY_JAR_NAME.jar</systemPath>
7
</dependency>
We just need to:
- add this dependency to our pom.xml
- import maven dependency (reimport with intellij IDEA or run
mvn clean install
command)
In order to include external JAR library into our WAR we need to add below plugin to pom.xml:
xxxxxxxxxx
1
<plugin>
2
<artifactId>maven-war-plugin</artifactId>
3
<version>2.4</version>
4
<configuration>
5
<failOnMissingWebXml>false</failOnMissingWebXml>
6
<webResources>
7
<resource>
8
<directory>${project.basedir}/external_libs</directory>
9
<targetPath>WEB-INF/lib</targetPath>
10
<filtering>false</filtering>
11
<includes>
12
<include>**/*.jar</include>
13
</includes>
14
</resource>
15
</webResources>
16
</configuration>
17
</plugin>