--- title: win10配置gradle createTime: 2022/04/25 tags: - Windows --- ## 配置 PATH ## 修改默认缓存目录 ```powershell gradle -g C:\Program Files\Gradle\.gradle ``` 这个错误 `Failed to load native library 'native-platform.dll' for Windows 10 amd64.` 是因为权限不够 ## 配置国内源 在默认缓存目录下新建 init.gradle 文件 ```ini allprojects { repositories { def ALIYUN_REPOSITORY_URL = 'https://maven.aliyun.com/repository/public' all { ArtifactRepository repo -> if(repo instanceof MavenArtifactRepository){ def url = repo.url.toString() if (url.startsWith('https://repo1.maven.org/maven2')) { project.logger.lifecycle "Repository replaced by ALIYUN_REPOSITORY_URL." remove repo } } } maven { url ALIYUN_REPOSITORY_URL } } } ```