Vladyslav Nikolaiev
Vladyslav Nikolaiev

Reputation: 2029

Gradle vs Maven. Behavior with java Deprecated API usage

I have big project that uses Maven as building tool. It performs install operation for about ~30 min. I decided to move to Gradle since it's considered as faster building tool. But I faced a problem at compileJava task that looks like next :

[ERROR] [system.err] Note: /home/user/IdeaProjects/SomeClass.java uses or overrides a deprecated API.

After such errors Gradle stops build process, but Maven completes install operation successfully.

So, my question is there a way to get rid of such Gradle behavior?

Upvotes: 1

Views: 1112

Answers (1)

Louis Jacomet
Louis Jacomet

Reputation: 14500

By default the Java compiler does not treat deprecation warnings as compile errors. The Java plugin in Gradle obeys the same default, so you must have configured it to do so. In short, somewhere in your build, javac is given the option -Werror.

It could look like:

compileJava {
  options.compilerArgs += ['-Werror']
}

If you do not want the build to fail on compiler warnings, this option needs to be removed from your configuration.

Upvotes: 2

Related Questions