javamavengradle

Why isn't maven looking in my ~/.m2 folder?


I have a local fork of a plugin in my maven local folder, but for some reason maven isn't searching my ~/.m2 folder (I'm on a Mac).

Could not find org...
Searched in the following locations:
file:/Applications/Android Studio.app/Contents/gradle/m2repository/org/...
...
https://repo1.maven.org/maven2/org/...
...
https://jcenter.bintray.com/org/...
...
https://maven.fabric.io/public/org/...
...
Required by:
:MobileApp:unspecified

What other information would be useful in figuring this out? I don't have a pom.xml or settings.xml file in the project.


Solution

  • That seems to be a gradle build. Therefore you don't have a pom.xml. Check which repos are defined in your build.gradle (look for a repositories{} block). I guess what you'll find is something like this:

    repositories {
      mavenCentral()
    }
    

    If you want gradle to use your local maven repository you can just tell him:

    repositories {
      mavenCentral()
      mavenLocal()
    }
    

    Be aware that you can define different repos for your gradle build-plugins and for the build itself! The first one is located at the buildScript block while the second one is a toplevel element.

    Hope that helps.