Setting up a local repository for Maven in Spring Boot’s build.gradle

Setting up a local repository for Maven in Spring Boot’s build.gradle

Depending on the version of Spring Boot, the remote repository may be JCenter or MavenCentral, both of which are remote (external) repositories.

If you want to set up a local repository, you need to modify build.gradle as follows

    url "c:/maven/repository" // This is the local repository

Local repositories, as the name implies, are local.

Location of mvn local repository settings

To install mvn and configure the local repository, there is a file called settings.xml under the installation directory (in my case, C:\maven\conf).

In this file, <localRepository> at around line 53 is used to configure the settings.


If you want to write your own libraries, etc. in dependencies and describe them in dependencies, you can create a local repository like this.

mvn local repository check command

Edit settings.xml and check if the local repository has been changed with the following command.

mvn help:evaluate -Dexpression=settings.localRepository

Publish your own library to a local repository

To publish your own library (jar) to the local repository, maven must be installed.

Assuming that the path to the mvn command has been passed, execute the following command.

Assume that you have a “home-made library (jar)” under “C:\temp\”.

cd C:\temp
mvn install:install-file -Dfile=自作ライブラリ.jar -DartifactId=xxx -Dversion=1.0.0 -Dpackaging=jar

This will create a folder named “homebrew library” under “c:\maven\repository”.

In this folder, you will find the necessary files and jars.

By putting this in dependencies of build.gradle, you can put the library of your own local repository in dependencies.

There is a rule for describing in dependencies, which is as follows


In the above mvn command, it is as follows.

implementation '

This will create a folder in the local repository that can be added to the dependencies in build.gradle.

It is also possible to deploy to the Maven local repository in build.gradle using uploadArchives.