You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by dror <dr...@gmail.com> on 2012/07/12 18:03:05 UTC

How to change java compiler warning to error

I'm trying to change java compiler warning to error and error to warning. 
For example: 
fallthroughCase=error
nullReference=error 
enumIdentifier=error 
וnusedObjectAllocation=warning 
redundantNullCheck=warning

It is easily done on the Eclipse environment, but I haven't found a way to
do the same on our build server. Any help would be mostly appreciated! 

Thanks, Dror

--
View this message in context: http://maven.40175.n5.nabble.com/How-to-change-java-compiler-warning-to-error-tp5713975.html
Sent from the Maven - Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: How to change java compiler warning to error

Posted by Wayne Fay <wa...@gmail.com>.
> Xlint flags dont cover all my warnings that i wish to change to error. I
> have other warnings that dont hava a suitable Xlint flag. There is a way to
> import a compiler's preferences file which includes my settings? there is a
> another solution?

The only thing that occurs to me is to tell Maven to use JDT as your
compiler rather than javac, and then somehow tell JDT to fail on those
warnings.

PS- Google can tell you how to do this with "maven jdt compiler" as
the search phrase.

Wayne

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: How to change java compiler warning to error

Posted by dror <dr...@gmail.com>.
Hi Curtis,
first, thanks a lot for your response. But, i already meet and try this
solution, and it doesnt satisfied enough.
Xlint flags dont cover all my warnings that i wish to change to error. I
have other warnings that dont hava a suitable Xlint flag. There is a way to
import a compiler's preferences file which includes my settings? there is a
another solution? 
thanks a lot, Dror.

--
View this message in context: http://maven.40175.n5.nabble.com/How-to-change-java-compiler-warning-to-error-tp5713975p5714146.html
Sent from the Maven - Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: How to change java compiler warning to error

Posted by Curtis Rueden <ct...@wisc.edu>.
Hi Dror,

> I'm trying to change java compiler warning to error and error to warning.
> It is easily done on the Eclipse environment, but I haven't found a way to
> do the same on our build server.

Javac (which is what Maven uses) is a completely different compiler than
Eclipse's JDT core compiler. That said, Javac does allow you to control
some things. You can set the build to fail if there are any warnings using
the -Werror flag, and you can control which sorts of things are reported as
warnings using the -Xlint flags (see e.g.
http://docs.oracle.com/javase/1.5.0/docs/tooldocs/windows/javac.html).

HTH,
Curtis

P.S. I found this information very quickly on StackOverflow with a Google
search for "javac warnings errors":

http://stackoverflow.com/questions/1040074/javac-treat-warnings-as-errors


On Thu, Jul 12, 2012 at 11:03 AM, dror <dr...@gmail.com> wrote:

> I'm trying to change java compiler warning to error and error to warning.
> For example:
> fallthroughCase=error
> nullReference=error
> enumIdentifier=error
> וnusedObjectAllocation=warning
> redundantNullCheck=warning
>
> It is easily done on the Eclipse environment, but I haven't found a way to
> do the same on our build server. Any help would be mostly appreciated!
>
> Thanks, Dror
>
> --
> View this message in context:
> http://maven.40175.n5.nabble.com/How-to-change-java-compiler-warning-to-error-tp5713975.html
> Sent from the Maven - Users mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>