Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

McJava fails with NPE when Protobuf Gradle Plugin is not applied to a project #85

Open
alexander-yevsyukov opened this issue Apr 14, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@alexander-yevsyukov
Copy link
Contributor

Here's the top of the stacktrace of interest:

Caused by: java.lang.NullPointerException
        at io.spine.tools.gradle.protobuf.LegacyApi.<init>(ProtobufGradlePluginAdapter.kt:188)
        at io.spine.tools.gradle.protobuf.AdapterImpl$Companion.createDelegate(ProtobufGradlePluginAdapter.kt:93)
        at io.spine.tools.gradle.protobuf.AdapterImpl.<init>(ProtobufGradlePluginAdapter.kt:87)
        at io.spine.tools.gradle.protobuf.ProtobufGradlePluginAdapterKt.getProtobufGradlePluginAdapter(ProtobufGradlePluginAdapter.kt:80)
        at io.spine.tools.mc.java.gradle.plugins.McJavaPlugin.setProtocArtifact(McJavaPlugin.java:68)
        at io.spine.tools.mc.java.gradle.plugins.McJavaPlugin.apply(McJavaPlugin.java:61)
        at io.spine.tools.mc.java.gradle.plugins.McJavaPlugin.apply(McJavaPlugin.java:52)

The problem is caused by this code:

private class LegacyApi(override val project: Project): ProtobufGradlePluginAdapter {
    //...
    private val convention: Any = project.convention.plugins["protobuf"]!!
@alexander-yevsyukov alexander-yevsyukov added the bug Something isn't working label Apr 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant