开发者

Where's the exception message?

I meet a weired problem when I use maven. I execute the following code using "maven exec:java". Obviously, it should throw a RuntimeException, but I did not see anything in console. But if I execute it in eclipse, I can see the error message. So where does the exception gone ? Thanks

public class HelloWorld {

    public static class MyThread extends Thread {

        @Override
        public void run() {
            String str = null;
            str = str.trim();
        }
    }

    public static void main(String[] args) throws Interrup开发者_Go百科tedException, IOException {
        MyThread thread = new MyThread();
        thread.start();
        System.in.read();
    }
}


Might be a bug of the Maven Exec Plugin (see issues like MEXEC-89 or MEXEC-80). Try with the version 1.2 of the plugin:

mvn org.codehaus.mojo:exec-maven-plugin:1.2:java -Dexec.mainClass="com.acme.Foo"


You could also try adding the -e command line option to your mvn call, I think that solved a similar problem I had.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜