Technology Consulting
Return to: Gradle Reference

Publishing to your local Maven repository

How to add your local Maven repository as an artifact publication destination

In your build.gradle file:

Add the maven-publish plugin to the plugins section:

plugins {
    id 'java'
    id 'maven-publish'
}

Add the following to the publishing section. Replace my_username with your username. If your build.gradle file doesn't have one, create it:

publishing {
    publications {
        maven(MavenPublication) {
            from components.java
        }
    }

    repositories {
        maven {
            url 'file:///Users/my_username/.m2/repository'
        }
    }
}
Return to: Gradle Reference