How to add maven central repository in build.gradle


In order to add the Maven Central Repository to your Java project, all you need to do is add the below to the repositories block of the build.gradle file.


repositories {
    mavenCentral()
}

Note: Make sure to add this repository block outside of any other dependencies or plugins.


Example:
plugins {
   ...
   //plugins
   ...
}

repositories {
    mavenCentral()
}

dependencies {
   ...
   //project dependencies
   ...
}

-

Facing issues? Have Questions? Post them here! I am happy to answer!


Author: Rakesh
Author Info:

Rakesh is a seasoned developer with over 10 years of experience in web and app development, and a deep knowledge of operating systems. Author of insightful How-To articles for Code2care.

Follow him on: X

Copyright © Code2care 2023 | Privacy Policy | About Us | Contact Us | Sitemap