gpt4 book ai didi

svn - grails 将 svn 修订添加到 app.version

转载 作者:行者123 更新时间:2023-12-05 01:20:46 24 4
gpt4 key购买 nike

我正在尝试将 svn 修订版添加到我的 app.version 而不需要 ant 或其他类似的外部工具。看起来我可能能够为此 Hook _Events.groovy,但文档相对稀少。

有人知道怎么做吗?

最佳答案

This Grails nabble 邮件列表中的链接包含您正在寻找的解决方案。为了完整起见,还将代码放在这里:

scripts/_Events.groovy

eventWarStart = { type -> 

println "******************* eventWarStart *****************"
try {
// initialise SVNKit
DAVRepositoryFactory.setup();
SVNRepositoryFactoryImpl.setup();
FSRepositoryFactory.setup();

SVNClientManager clientManager = SVNClientManager.newInstance();
println "clientManager = " + clientManager.toString();
SVNWCClient wcClient = clientManager.getWCClient();
println "wcClient = " + wcClient.toString();

// the svnkit equivalent of "svn info"
File baseFile = new File(basedir);

println "baseFile = " + baseFile.toString();
SVNInfo svninfo = wcClient.doInfo(baseFile, SVNRevision.WORKING);
println "svninfo = " + svninfo.toString();

def version = svninfo.getURL();
println "Setting Version to: ${version}"
metadata.'app.version' = "${version}".toString()
metadata.persist()

}
catch (SVNException ex) {
//something went wrong
println "**************** SVN exception **************"
println ex.getMessage();
}

} // End eventWarStart()

关于svn - grails 将 svn 修订添加到 app.version,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5263995/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com