1. 程式人生 > >獲取SVN版本號

獲取SVN版本號

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