maven:add_local_repository_for_project

Add Local Repository for Project

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>
  • maven/add_local_repository_for_project.txt
  • Last modified: 2021/01/06 19:39
  • by chongtin