简体   繁体   中英

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM