android 使用mavenLocal()引用本地maven仓库(windows)

settings.xml中配置本地仓库地址,C:\Users\lv\.m2\repository 为你本地仓库路径,修改成你的就行



    C:\Users\lv\.m2\repository
    
        
            alimaven
            aliyun maven
            http://maven.aliyun.com/nexus/content/groups/public/
            central
        
        
            jitpack
            jitpack
            jitpack库
            https://jitpack.io
        
    

android build.gradle中使用mavelLocal()引用

allprojects {
    repositories {
        mavenLocal()
        maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
        maven { url 'http://maven.aliyun.com/nexus/content/repositories/jcenter' }
        maven { url 'http://maven.aliyun.com/nexus/content/repositories/google' }
        maven { url 'http://maven.aliyun.com/nexus/content/repositories/gradle-plugin' }
        mavenCentral()
        maven { url "https://jitpack.io" }
    }
}

mavenLocal的解释

    /**
     * Adds a repository which looks in the local Maven cache for dependencies. The name of the repository is
     * {@value org.gradle.api.artifacts.ArtifactRepositoryContainer#DEFAULT_MAVEN_LOCAL_REPO_NAME}.
     *
     * 

Examples:

*
     * repositories {
     *     mavenLocal()
     * }
     * 
*

* The location for the repository is determined as follows (in order of precedence): *

*
    *
  1. The value of system property 'maven.repo.local' if set;
  2. *
  3. The value of element <localRepository> of ~/.m2/settings.xml if this file exists and element is set;
  4. *
  5. The value of element <localRepository> of $M2_HOME/conf/settings.xml (where $M2_HOME is the value of the environment variable with that name) if this file exists and element is set;
  6. *
  7. The path ~/.m2/repository.
  8. *
* * @return the added resolver */ MavenArtifactRepository mavenLocal();

你可能感兴趣的:(android 使用mavenLocal()引用本地maven仓库(windows))