Gradle init gets NPE for complex POM

I just started working on a large open-source project that builds with Maven. I just decided to give “gradle init” a try in one of the subprojects that I’ll probably be trying to implement a Gradle build for.

It fails with the following (partial) stacktrace:

Caused by: java.lang.NullPointerException

I believe this is the line referenced at the top of the stacktrace (this is from decompiled source):

File checkFile = new File(session.getLocalRepository().getBasedir(), session.getLocalRepositoryManager().getPathForRemoteMetadata(metadata, repository, request.getRequestContext()));

The POM in question is pretty big. Before I try to provide details of the POM and project, does this stacktrace provide any obvious clues?

Just as a wild guess, I’ve seen NPEs thrown when doing conversions on POMs with parents that can’t be reached. For example, project uses relative paths to locate parent POM which is now unreachable if you’ve restructured the project at all.

The top-level pom references a parent whose artifact is installed in my maven cache, and the “relativePath” element has no property settings. I tried removing that and it made no difference. All the other POMs have a relativePath of “…” or “…/…”. It would take me a while to verify that all of those are the correct location, but I have a feeling they will all be correct.