Pergunta

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.

Foi útil?

Solução

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.

Outras dicas

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>
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top