Gradle使用记录

kyaa111 11天前 ⋅ 12 阅读
  1. 下载Gradle
  2. 环境变量配置GRADLE_HOME 指向安装目录
  3. 环境变量配置GRADLE_USER_HOME 指向依赖下载目录
  4. Path中添加%GRADLE_HOME%\bin
  5. USER_HOME路径, 路径示例: C:\Users\root\.m2. 添加settings.xml文件配置maven本地仓库地址, 如下.
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
  <localRepository>E:\soft\maven\repository\</localRepository>

  <mirrors>
    <mirror>  
		<id>nexus-aliyun</id>  
		<mirrorOf>central</mirrorOf>    
		<name>Nexus aliyun</name>  
		<url>http://maven.aliyun.com/nexus/content/groups/public</url>  
	</mirror>

	<mirror>  
		<id>maven</id>  
		<mirrorOf>central</mirrorOf>    
		<name>maven</name>  
		<url>http://repo1.maven.org/maven2/</url>  
	</mirror>
  </mirrors>
</settings>
  1. 项目中配置
repositories {
    mavenLocal()
    maven { url "https://maven.aliyun.com/repository/public" }
    maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
    mavenCentral()
}
  1. 再使用maven-publish插件, 就可以直接将项目发布到本地仓库