Gradle使用记录

2022-12-03 22:18:53 浏览数 (1)

  1. 下载Gradle
  2. 环境变量配置GRADLE_HOME 指向安装目录
  3. 环境变量配置GRADLE_USER_HOME 指向依赖下载目录
  4. Path中添加%GRADLE_HOME%bin
  5. USER_HOME路径, 路径示例: C:Usersroot.m2. 添加settings.xml文件配置maven本地仓库地址, 如下.
代码语言:javascript复制
<?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:softmavenrepository</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>

6. 项目中配置

代码语言:javascript复制
repositories {
    mavenLocal()
    maven { url "https://maven.aliyun.com/repository/public" }
    maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
    mavenCentral()
}

7. 再使用maven-publish插件, 就可以直接将项目发布到本地仓库

0 人点赞