2014-06-24 27 views
1

我使用SBT與一罐子的插件,但是當我運行已創建我得到消息的連續流了一罐子的可執行文件,如下所示:如何從單jar可執行文件關閉應用程序加載的警告?

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) 

我試圖傳遞參數如對one-jar remove verbose warning information on application load的幾個迴應中所建議的那樣,但我仍然得到惱人的警告。

如何在使用sbt-onejar時關閉這些警告?

我使用的是最新版本的sbt-onejar

+0

你介意共享構建配置,以便重現錯誤並解決它嗎?我寧願不必花時間自己做。 –

回答

1

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,我不知道這是可能的)。

+0

謝謝。不是我**真的**想要的答案...... – rapvelopment

相關問題