How to include external jars in maven jar build process?
A simple solution for this is to add it into local maven repository
One way to do is via mvn install commands as suggested in previous post .
Another easy way is,
- In your eclipse ide right click on project select Maven option.
- Select Install or deploy an artifact to a maven repository option and click on next.
- Click on browse next to the Artifact file checkbox & select your jar file.
- Enter the GroupId and ArtifactId and version ensure generate pom & create checksum are checked & packaging is jar
Click on finish, Wallah!!! your job is done the jar is added in your local repository which you can define in setting.xml or m2 directory.
Now just add the simple maven dependency as per the GroupId,ArtifactId & jar version that you have entered as per the import and that's it your external jar will be packaged by maven.
You can include the external jars in your build path as dependency with <scope>system</scope>
.
Check this link
You need use below command to add external jar into .m2 folder
mvn install:install-file -Dfile=[JAR] -DgroupId=[some.group] -DartifactId=[Some Id] -Dversion=1.0.0 -Dpackaging=jar
This will add the given jar in to your .m2 folder. After that go to pom.xm and just add the dependency with given group id, artifact id and version.