:jrubyPrepare fails with NPE after migration to spring-boot 2
Closed this issue · 6 comments
Hi!
I'm developing service using spring boot and asciidoctor-gradle-plugin + jruby-gradle-plugin for my project docs generation. After migration of my project from spring boot 1.5.6.RELEASE to 2.0.0.RELEASE version i've run into a problem that my build fails executing 'jrubyPrepare' task with following error:
Execution failed for task ":jrubyPrepare". Could not resolve all files for configuration ":gems". java.lang.NullPointerException (no error message)
Considering the log message, it fails while trying to resolve gems dependencies:
at com.github.jrubygradle.GemUtils.extractGems(GemUtils.groovy:62) at com.github.jrubygradle.GemUtils$extractGems$0.call(Unknown Source) at com.github.jrubygradle.JRubyPrepare.copy(JRubyPrepare.groovy:54)
I've made example project so you can reproduce this exception - example. If i change spring boot version to 1.5.6.RELEASE or delete dependency to asciidoctor-diagram gem - everything works fine.
It would be great if you gave me some idea of how i could fix this issue.
Similar problem with jruby prepare
Here I have uploaded a sample run with --debug
and --stacktrace
enabled: https://gist.github.com/behrangs-sportsbet/713f59abc886968d536eff901858a390
I had the same behavior with Spring Boot 2.0.1 but with 2.0.2 it seems to work.
Related issue in spring boot 2 gradle plugin spring-projects/spring-boot#12897
This a Gradle bug. SP2 Gradle plugin trigger this bug. In 2.0.2.RELEASE Spring Team fix this, but for gradle 4.7 bug still reproduce..
I have reproduced this with our latest release, 1.7.0. Bummer! I'll see if I can figure out what the heck is going on here.
Did the necessary digging in our code, and while this is fixed with the 2.0.2 spring-boot plugin, the reason it affected jrubyPrepare
is because something outside of our control was shoving things which were not File
objects into the gems
configuration.
When the extractGems
code was iterating over the FileCollection
it was coming across a NULL rather than a real file. 💣
With Gradle 4.10.2, JRuby/Gradle 1.7.0, and spring-boot-gradle 2.0.2, this problem goes away.