Injecting current git commit id into Java webapp

后端 未结 6 1173
抹茶落季
抹茶落季 2020-12-08 16:14

We have a git repository which contains source for a few related Java WARs and JARs. It would be nice if the Java code could somehow:

System.err.println(\"I          


        
6条回答
  •  温柔的废话
    2020-12-08 16:48

    I wrote an Ant task to get the buildnumber using JGit API (without git command line app), see jgit-buildnumber-ant-task. Then you can store this buildnumber inside MANIFEST.MF file and get it from the classpath on runtime.

提交回复
热议问题