Assume we want yo create a local maven repository for a project. We locate it in ./libs under the project directory. After running this script, you will see a new directory /libs created.
mvn install:install-file -Dfile=your-jar-file-name-1.0.0.jar -DgroupId=com.exmaple -DartifactId=your-jar-file-name - Dversion=1.0.0 -Dpackaging=jar -DlocalRepositoryPath=./libs
In pom.xml, add repositories:
<project .... . . . <repositories> <repository> <id>in-project</id> <name>In Project Repo</name> <url>file://${project.basedir}/libs</url> </repository> </repositories>
and now you can add the dependency:
<dependency> <groupId>com.example</groupId> <artifactId>your-jar-file-name</artifactId> <version>1.0.0</version> </dependency>