Why does Gradle not look in the local maven repository for plugins?

前端 未结 2 751
离开以前
离开以前 2021-01-02 03:33

I have built a Gradle plugin and published it to the local maven repository. I can see it in my ~/.m2/repository. However, when I run a Gradle project to use this plugin, it

相关标签:
2条回答
  • 2021-01-02 03:57

    I think you need to add below URL in buildscript > repositories > maven inside the build.gradle for the project module. See below code for adding the URL for the same:

    buildscript {
    
        repositories {
            maven {
                url = "https://plugins.gradle.org/m2/"
            }
        }
    
        dependencies {   
            classpath 'com.android.tools.build:gradle:3.0.1'           
        }
    }
    

    Then you are done.

    Hope this will help you :)

    All the best.

    0 讨论(0)
  • 2021-01-02 03:58

    I think that specifying a custom plugin repository looks promising: this feature lets you configure the plugins{} DSL to resolve from other repositories in addition to the gradle plugin portal. I think you'd want to update your settings.gradle with configuration something along the lines of:

    pluginManagement {
      repositories {
          mavenLocal()
          gradlePluginPortal()
      }
    }
    

    (Note that this code block needs to appear at the top of settings.gradle).

    0 讨论(0)
提交回复
热议问题