我想在manifest.mf文件中使用git commitId。在当前的gradle-release-plugin版本中,标签将在构建任务之后完成。因此在manifest.mf文件中不能使用git commitId。有没有计划支持这样的东西?对于在manifest.mf文件中使用git commitId有什么想法吗?
发布于 2016-08-23 05:10:03
嘿,你可以在不接触插件的情况下使用executor来帮助你做到这一点。
使用gradle 2.13测试
import net.researchgate.release.cli.Executor
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'net.researchgate:gradle-release:2.4.0'
}
}
apply plugin: 'java'
apply plugin: 'net.researchgate.release'
jar {
def executor = new Executor(logger)
def version = executor.exec(['git', 'rev-parse', 'HEAD'], errorMessage: 'Error while getting last git commit id')
manifest {
attributes("Implementation-Title": "Gradle",
"Implementation-Version": version)
}
}https://stackoverflow.com/questions/37014120
复制相似问题