獲取SVN版本號
阿新 • • 發佈:2019-06-05
import org.tmatesoft.svn.core.wc.*
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
classpath group: 'org.tmatesoft.svnkit', name: 'svnkit', version: '1.9.3'
}
def getSvnRevisionByPlatform() {
ISVNOptions options = SVNWCUtil.createDefaultOptions(true);
SVNClientManager clientManager = SVNClientManager.newInstance(options);
SVNStatusClient statusClient = clientManager.getStatusClient();
SVNStatus status = statusClient.doStatus(projectDir, false);
SVNRevision revision = status.getRevision();
def svnNum = revision.getNumber();
return svnNu