Reputation: 308
I am developing an application with JavaPos inclusive. The problem I have is that I am using maven but the hardware manufacturer's libs are all in jars and xml file. How do I bundle them as a maven dependency and use them in my maven project.
Any good idea is welcome so long as it helps me get this done quickly. Help really needed.
Upvotes: 0
Views: 301
Reputation: 2968
Add external jars to local .m2 (for local development)
This approach is not distributable. It assumes just putting jars to local .m2 and nothing more.
For adding jars to local maven repository:
mvn install:install-file -Dfile=<path-to-file> -DgroupId=<group-id> -DartifactId=<artifact-id> -Dversion=<version>
<path-to-file>
- is path to jar
Create a new maven repo and distribute it within a project
This approach assumes creating a new maven repository, which will include only external jars. Then this repository placed to the project root, added to git and referented by the project pom.
So anyone, who will download the project will have all maven dependencies in place without extra actions.
Adding jar to the new maven repo:
mvn deploy:deploy-file -Dfile=<path-to-file> -DgroupId=<group-id> -DartifactId=<artifact-id> -Dversion=<version> -Dpackaging=jar -Durl=file:./.m2/repository/ -DrepositoryId=project-internal -DupdateReleaseInfo=true
Then reference the repo in your pom:
<repositories>
...
<repository>
<id>project-internal</id>
<url>file:///${project.basedir}/.m2/repository</url>
</repository>
</repositories>
Reference
https://www.google.com/amp/s/roufid.com/3-ways-to-add-local-jar-to-maven-project/amp/
Upvotes: 2