Appearance
发布到 Ivy 仓库
Ivy 是另一种构件仓库格式,主要在旧项目或特定企业环境中使用。
基本配置
kotlin
plugins {
`java-library`
`ivy-publish`
}
java {
withSourcesJar()
}
publishing {
publications {
create<IvyPublication>("ivyJava") {
from(components["java"])
descriptor {
license {
name.set("The Apache License, Version 2.0")
url.set("https://www.apache.org/licenses/LICENSE-2.0.txt")
}
author {
name.set("John Doe")
url.set("https://example.com")
}
description {
text.set("My Ivy library")
homepage.set("https://github.com/example/my-lib")
}
}
}
}
repositories {
ivy {
name = "localIvy"
url = uri("file://${rootProject.projectDir}/ivy-repo")
layout("gradle")
}
ivy {
name = "remoteIvy"
url = uri("https://ivy.example.com/repo")
credentials {
username = providers.gradleProperty("ivyUsername").orNull
password = providers.gradleProperty("ivyPassword").orNull
}
}
}
}发布命令
bash
# 发布到本地 Ivy 仓库
./gradlew publishIvyJavaPublicationToLocalIvyRepository
# 发布到所有仓库
./gradlew publish下一步
- 多项目构建基础 - 多模块项目管理