作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有一个build.gradle
文件,该文件带有要发布的 Artifact ,并遵循Ivy publishing documentation中给出的准则。
publishing {
publications {
ivy(IvyPublication) {
from components.java
descriptor.withXml {
asNode().info[0].appendNode("description", description)
}
}
}
}
PublishToIvyRepository
任务,我想对其进行配置,以使其转到正常的其他存储库,但使用与上述代码相同的发布。我最初的尝试是这样的:
task publishToIvyLocal(type: PublishToIvyRepository) {
repository = mySpecialRepository
publication = project.publishing.publications[0]
}
publishing {}
块之前,则会出现以下错误:
Cannot configure the 'publishing' extension after it has been accessed.
project.publishing.publications[0]
并不是重用此出版物的最佳方法。
最佳答案
无需自己创建PublishToIvyRepository
任务。
Applying the
'ivy-publish'
plugin does the following:
- [...]
- Establishes a rule to automatically create a
PublishToIvyRepository
task for the combination of eachIvyPublication
added (see Section 35.2, “Publications”), with eachIvyArtifactRepository
added (see Section 35.3, “Repositories”).
The created task is named
publish«PUBNAME»PublicationTo«REPONAME»Repository
, which ispublishIvyJavaPublicationToIvyRepository
for this example.
publishing {
publications {
mySpecial(IvyPublication) {
// configure publication
}
}
repositories {
ivy {
name = 'first'
// configure first repository
}
ivy {
name = 'second'
// configure second repository
}
}
}
这应该创建以下任务:
publishMySpecialPublicationToFirstRepository
publishMySpecialPublicationToSecondRepository
The name for this repository. A name must be unique amongst a repository set. A default name is provided for the repository if none is provided.
关于gradle - 如何在自定义PublishToIvyRepository任务中重用IvyPublication?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48410071/
我是一名优秀的程序员,十分优秀!