我想将工件发布到 ivy 存储库,但它不起作用。我阅读了这篇文章,并在阅读后创建了这个示例构建:
task ivyPublishTest << {
def buildDir = new File("build")
buildDir.mkdirs()
def fileToPublish = new File("build/file.abc")
fileToPublish.write("asdasdasd")
}
artifacts {
archives(ivyPublishTest.fileToPublish) {
name 'gradle-test-artifact'
builtBy ivyPublishTest
}
}
uploadArchives {
repositories {
ivy {
url "http://my.ivy.repo/ivyrep/shared"
}
}
}
当然,问题是它不起作用。我收到这个错误Could not find property 'fileToPublish' on task ':ivyPublishTest'