我在单罐插件中使用sbt,但是当我运行已创建的单罐可执行文件时,会得到连续的消息流,如下所示:
JarClassLoader: Warning: net/liftweb/json/Formats$$anon$4.class in lib/lift-json_2.9.2-2.5-M3.jar is hidden by lib/lift-json_2.9.1-2.4.jar (with different bytecode)
JarClassLoader: Warning: net/liftweb/json/JsonParser$BoolVal$.class in lib/lift-json_2.9.2-2.5-M3.jar is hidden by lib/lift-json_2.9.1-2.4.jar (with different bytecode)
JarClassLoader: Warning: net/liftweb/json/TypeInfo.class in lib/lift-json_2.9.2-2.5-M3.jar is hidden by lib/lift-json_2.9.1-2.4.jar (with different bytecode)
JarClassLoader: Warning: net/liftweb/json/Meta$$anonfun$mappingOf$1.class in lib/lift-json_2.9.2-2.5-M3.jar is hidden by lib/lift-json_2.9.1-2.4.jar (with different bytecode)
我尝试按照对一对一的响应中的建议将参数传递给jvm,以消除有关应用程序负载的详细警告信息,但我仍然收到烦人的警告。
使用sbt-onejar时如何关闭这些警告?
我正在使用sbt-onejar的最新版本。
tl; dr由于消息来自,因此没有简单的方法将其关闭System.err
。
我对该插件知之甚少,因此JarClassLoader
按如下所示解压缩该类:
jar -xf src/main/resources/one-jar-boot-0.98.jar src/com/simontuffs/onejar/JarClassLoader.java
在该类中,在998行有对WARNING
方法的调用:
if (!Arrays.equals(existing.bytes, bytes) && !name.startsWith("META-INF")) {
// TODO: this really needs to be a warning, but there needs to be a way
// to shut it down. INFO it for now. Ideally we need to provide a
// logging layer (like commons-logging) to allow logging to be delegated.
if (name.endsWith(".class")) {
// This is probably trouble.
WARNING(existing.name + " in " + jar + " is hidden by " + existing.codebase + " (with different bytecode)");
} else {
INFO(existing.name + " in " + jar + " is hidden by " + existing.codebase + " (with different bytes)");
}
} else {
VERBOSE(existing.name + " in " + jar + " is hidden by " + existing.codebase + " (with same bytecode)");
}
该方法WARNING
实现如下:
protected void WARNING(String message) {
System.err.println(PREFIX() + "Warning: " + NAME() + message);
}
导致我断言关闭它是不可能的(除非您可以关闭System.err
我不知道有可能关闭的整个设备)。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句