one-jar remove verbose warning information on application load

后端 未结 9 2209
一个人的身影
一个人的身影 2021-02-19 17:18

I am using Maven, with the one-jar pluggin, but when I run the one jar executable, I\'m greeted with a wall of warnings, this is unacceptable for use

I\'ve looked at eve

相关标签:
9条回答
  • 2021-02-19 17:36

    It seems that these messages are printed when running in "verbose" mode. What I don't get is that the verbose mode doesn't seem to be activated by default.

    Anyway, could you try to set the one-jar.verbose system property to false when running your one-jar:

    java -Done-jar.verbose=false -jar <one-jar.jar>
    
    0 讨论(0)
  • 2021-02-19 17:38

    There is no way to do this without modifying the source code

    0 讨论(0)
  • 2021-02-19 17:42

    I found that if you create a one-jar.properties file and put it in the root of your runtime classpath (ie, where your project .class files end up), it will be read by the one-jar Boot class. An entry in this properties file such as:

    one-jar.silent=true
    

    will suppress the one-jar log messages altogether.

    Other values that the Boot class looks for are one-jar.info and one-jar.verbose.

    The default level is INFO. As Pascal Thivent indicated above, you can also set a System property via the command line with the -D parameter of the java command, but if you do not want to have to stipulate or remember this, the properties file approach works great.

    0 讨论(0)
  • 2021-02-19 17:42

    There's two places to get the one-jar plugin from.

    1. https://github.com/jolira/onejar-maven-plugin
    2. http://code.google.com/p/onejar-maven-plugin/

    The 1st one claims to be just a copy of the 2nd one that's served from Maven's main repository. I was encouraged to use this one as it doesn't require specifiying an additional plugin repository that the 2nd one requires. However, when I switched to use the 2nd one (the official one), this problem went away for me.

    Note - passing -Done-jar.verbose=false worked for me but not when set in file one-jar.properties as someone stated above.

    0 讨论(0)
  • 2021-02-19 17:48

    I found I needed to use version 1.4.5 (1.4.4 did not work) and then the suggestion to place a one-jar.properties file at the root of my jar file with a single line reading one-jar.silent=true worked for me.

    0 讨论(0)
  • 2021-02-19 17:49

    I submitted a patch for this quite some time ago that merely makes the default behavior silent.

        public static final int LOGLEVEL_VERBOSE = 5;
    
        // Loglevel for all loggers.
     -  private static int loglevel = LOGLEVEL_INFO;
     +  private static int loglevel = LOGLEVEL_NONE;
    
        private final String prefix;
    

    AFAIK, it never got applied. Recently I fixed another issue, so I put my fixes out here:

    https://github.com/nsoft/uno-jar

    Please Re-read the "as is, no warranty" part of the license several times :)

    0 讨论(0)
提交回复
热议问题