我有一个gradle构建,必须将预先构建的jar文件作为工件发布。由于某种原因,它没有被接收。这是一个简化版本来重现它:
文件夹内容:
settings.gradle
build.gradle
some.jar
settings.gradle:
rootProject.name = 'some'
的build.gradle:
apply plugin: 'base'
apply plugin: 'maven-publish'
group = 'foo.bar'
version = '1.0'
task copyPrebuilt(type: Copy) {
from(projectDir) {
include 'some.jar'
rename 'some', "some-$version"
}
into distsDir
}
artifacts {
// should be 'archives'?
// http://stackoverflow.com/questions/39068090/gradle-archives-artifacts-not-populated-to-default-configuration
'default' (file("$distsDir/some-${version}.jar")) {
name 'some'
type 'jar'
builtBy copyPrebuilt
}
}
some-1.0.jar
未被~/.m2/repository/foo/bar/some/1.0
gradle publishToMavenLocal
任何线索?
答案 0 :(得分:2)
发布内容的最简单方法是定义发布对象:
publishToMavenLocal
此代码使<div role="tabpanel" class="tab-pane if(!empty($status2)) echo $status2; ?>" id="tab2">
任务将some-1.0.jar安装到本地maven存储库。