Gradle无法在Windows上读取正确的本地Maven存储库

我使用mavenLocal()让gradle使用本地的maven仓库。 我把我的settings.xml放在〜.m2下。 settings.xml如下所示:

<!-- localRepository | The path to the local repository maven will use to store artifacts. | | Default: ${user.home}/.m2/repository <localRepository>/path/to/local/repo</localRepository> --> <localRepository>d:/green/maven-repository</localRepository> 

运行maven命令时,mvn可以找到正确的存储库。 当运行gradle命令时,它仍然在寻找〜/ .m2 / repository。 它看起来像gradle无法正确读取d:/ green / maven-repository。

build.dradle

 buildscript { ext { springBootVersion = "1.5.2.RELEASE" kotlinVersion = "1.1.2" } repositories { mavenCentral() } dependencies { classpath("org.springframework.boot:spring-boot-gradle-plugin:$springBootVersion") classpath("org.jetbrains.kotlin:kotlin-noarg:$kotlinVersion") classpath("org.jetbrains.kotlin:kotlin-allopen:$kotlinVersion") classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion") } } apply { plugin("kotlin") plugin("kotlin-spring") plugin("kotlin-jpa") plugin("org.springframework.boot") plugin 'java' plugin 'idea' // plugin: 'spring-boot' } repositories { mavenLocal() mavenCentral() } jar { baseName = 'mini_springboot' version = '0.0.1' } sourceCompatibility = 1.8 targetCompatibility = 1.8 dependencies { compile("org.springframework.boot:spring-boot-starter-data-jpa") // compile("com.h2database:h2") compile("org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion") compile("org.jetbrains.kotlin:kotlin-reflect:$kotlinVersion") compile("com.fasterxml.jackson.module:jackson-module-kotlin:2.8.4") testCompile("org.springframework.boot:spring-boot-starter-test") compile("org.springframework.boot:spring-boot-starter-web") { exclude module: "spring-boot-starter-tomcat"