首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >gradle-release-plugin -在manifest.mf中使用git commitid

gradle-release-plugin -在manifest.mf中使用git commitid
EN

Stack Overflow用户
提问于 2016-05-04 04:50:20
回答 1查看 542关注 0票数 0

我想在manifest.mf文件中使用git commitId。在当前的gradle-release-plugin版本中,标签将在构建任务之后完成。因此在manifest.mf文件中不能使用git commitId。有没有计划支持这样的东西?对于在manifest.mf文件中使用git commitId有什么想法吗?

EN

回答 1

Stack Overflow用户

发布于 2016-08-23 05:10:03

嘿,你可以在不接触插件的情况下使用executor来帮助你做到这一点。

使用gradle 2.13测试

代码语言:javascript
复制
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)
    }
}
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/37014120

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档