在 gradle maven 发布期间向库添加前缀
adding prefixes to libs during gradle maven publishing
我为多项目构建设置了下一个配置:
allprojects {
apply plugin: 'maven-publish'
repositories {
mavenCentral()
}
}
subprojects {
apply plugin: 'java'
sourceCompatibility = 1.8
targetCompatibility = 1.8
version = rootProject.version
group = rootProject.group
archivesBaseName = "PREFIX-${it.name}"
}
但是前缀仅适用于构建的工件,而不适用于我执行发布任务时。有没有办法配置带有前缀的发布?
根据“Identity values in the generated POM”,下一个配置应该有效:
subprojects { project ->
...
publishing {
publications {
maven(MavenPublication) {
artifactId "PREFIX-${project.name}"
from components.java
}
}
}
}
我为多项目构建设置了下一个配置:
allprojects {
apply plugin: 'maven-publish'
repositories {
mavenCentral()
}
}
subprojects {
apply plugin: 'java'
sourceCompatibility = 1.8
targetCompatibility = 1.8
version = rootProject.version
group = rootProject.group
archivesBaseName = "PREFIX-${it.name}"
}
但是前缀仅适用于构建的工件,而不适用于我执行发布任务时。有没有办法配置带有前缀的发布?
根据“Identity values in the generated POM”,下一个配置应该有效:
subprojects { project ->
...
publishing {
publications {
maven(MavenPublication) {
artifactId "PREFIX-${project.name}"
from components.java
}
}
}
}