문제

I have two fold questions,

  1. Are all the warning displayed in Eclipse under Problems view from Java compiler?
  2. If so, how can I list them with javac ant task? I have tried -Xlint:all and -Xmaxwarns 10000 as described here but no luck, it just display some of them but not all I see in eclipse.

I need this to fail a build if warnings go up with TeamCity, if you have better and easier suggestions please share.

Thanks.

도움이 되었습니까?

해결책

You can do it but you have to use eclipse compiler for this. Eclipse uses its own compiler, it is not regular javac. It is special because generates much more warnings than regular compiler and because can run code with compilation errors until you arrive in your flow to code that is not compiled.

다른 팁

Here's how to display all the Java Compiler warnings in Ant:

<javac destdir="${main.destdir}"
    ...
    ...>
    <compilerarg value="-Xlint"/>
    <compilerarg value="-Xmaxwarns"/>
    <compilerarg value="9999"/>
</java>

Note you can't combine <compilerarg value="xxx"> with <compilerarg line="xxx">, so I just use the value parameter.

If that doesn't work, what error do you get?

Ant:To see all compiler errors:

<javac debug="on" includeantruntime="false" .... >
       <compilerarg value="-Xlint:all" />
</javac>
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top