无法将 android 库添加到 JCenter
Can't add android library to JCenter
根据这篇文章,我正在尝试使用 Bintray 将库发布到 JCenter:https://medium.com/@anitaa_1990/6-easy-steps-to-upload-your-android-library-to-bintray-jcenter-59e6030c8890。
我已成功将库添加到 Bintray
,但是当我单击“添加到 JCenter”按钮并发送撰写消息时 - 我收到 错误:
Failed to send a message: Package should include sources as part of the package.
请告诉我我做错了什么?
您的 Bintray Maven 包不包含 sources
,仅包含 .aar
和 .pom
。在 blog post isn't linked to JCenter, see blog's package here.
Bintray 的 wiki 声明您必须包含 sources
。
对于今天到达此处的开发人员,请确保您的配置文件在 publishing{}
中包含 artifact(sourcesJar.get())
,如下面的这些行(不完整 build.gradle.kts
)。
val sourcesJar by tasks.registering(Jar::class) {
classifier = "sources"
from(sourceSets.main.get().allSource)
}
publishing {
publications {
create<MavenPublication>("default") {
from(components["java"])
artifact(dokkaJar)
}
}
publications.invoke {
publicationName(MavenPublication::class) {
artifactId = artifactID
artifact(sourcesJar.get()) // This line
}
}
}
根据这篇文章,我正在尝试使用 Bintray 将库发布到 JCenter:https://medium.com/@anitaa_1990/6-easy-steps-to-upload-your-android-library-to-bintray-jcenter-59e6030c8890。
我已成功将库添加到 Bintray
,但是当我单击“添加到 JCenter”按钮并发送撰写消息时 - 我收到 错误:
Failed to send a message: Package should include sources as part of the package.
请告诉我我做错了什么?
您的 Bintray Maven 包不包含 sources
,仅包含 .aar
和 .pom
。在 blog post isn't linked to JCenter, see blog's package here.
Bintray 的 wiki 声明您必须包含 sources
。
对于今天到达此处的开发人员,请确保您的配置文件在 publishing{}
中包含 artifact(sourcesJar.get())
,如下面的这些行(不完整 build.gradle.kts
)。
val sourcesJar by tasks.registering(Jar::class) {
classifier = "sources"
from(sourceSets.main.get().allSource)
}
publishing {
publications {
create<MavenPublication>("default") {
from(components["java"])
artifact(dokkaJar)
}
}
publications.invoke {
publicationName(MavenPublication::class) {
artifactId = artifactID
artifact(sourcesJar.get()) // This line
}
}
}