Using Apache Jena with Kotlin, works in Idea, fails with Gradle



I’m starting with Kotlin and I’m trying to implement a really simple example using a Java library (Apache Jena).

When I run it from Idea, it works, and the program exits properly, when I run it after a gradle build and try to run the produced jar with java -jar, it fails with a NullPointerException coming from that Java library.

I’m trying to build a “fat-jar” so I can deploy that as a stand-alone app. If there are other ways to do, I would be really happy to hear them.

The project is here:
and I get this error message:


I found that running

import org.apache.jena.query.ARQ.init()

Solves this issue.

But still, if someone knows, I would like to know why this is failing with gradle and not in Idea.