How to include external jars in maven jar build process?

岁酱吖の 提交于 2019-11-29 09:12:11

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.

swapnil thorat

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,

  1. In your eclipse ide right click on project select Maven option.
  2. Select Install or deploy an artifact to a maven repository option and click on next.
  3. Click on browse next to the Artifact file checkbox & select your jar file.
  4. 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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!