Injecting current git commit id into Java webapp

后端 未结 6 1174
抹茶落季
抹茶落季 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:53

    git rev-parse HEAD will print what you probably want (e.g. id of HEAD commit). You can make ant generate a simple Java class with this id as a static constant.

提交回复
热议问题