自动获取jar的版本号进行banner的打印

Signed-off-by: 与或非 <1016771049@qq.com>
This commit is contained in:
与或非
2022-09-27 10:23:48 +00:00
committed by Gitee
parent ed64dd58b4
commit 96dce63fd9

View File

@@ -31,7 +31,8 @@ public class LOGOPrinter {
}
private static String getVersion(){
Package pkg = LOGOPrinter.class.getPackage();
return (pkg != null) ? pkg.getImplementationVersion() : "DEV";
return Optional.ofNullable(LOGOPrinter.class.getPackage())
.map(Package::getImplementationVersion)
.orElse("DEV");
}
}