Take this scenario.
You are writing a new application A
B is an existing application that needs to be integrated with A
Now A is not in production yet and definitely not uploaded to your firm's Maven repository.
Or you might want to see how A works with B. Some basic integration, that I, as A's developer, need to ensure.
What I need is, to publish A in a local repository from where B will read from.
A and B both are gradle projects.
From A :
        
This uploads A's artifacts to m2 repository
And at B:
mavenLocal will read dependencies from local m2 repository.
You are writing a new application A
B is an existing application that needs to be integrated with A
Now A is not in production yet and definitely not uploaded to your firm's Maven repository.
Or you might want to see how A works with B. Some basic integration, that I, as A's developer, need to ensure.
What I need is, to publish A in a local repository from where B will read from.
A and B both are gradle projects.
From A :
    publishing {
        repositories {
            mavenLocal()
        }
        publications {
            mavenJava(MavenPublication) {
                from components.java
            }
        }
    }
This uploads A's artifacts to m2 repository
And at B:
repositories
{
        maven {
            url 'http://mavenAtMyFirm'
        }
        // Added to look for dependent
libraries in local maven repo. Helps in integration
        mavenLocal()
    }
mavenLocal will read dependencies from local m2 repository.