question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Gradle file example from Getting Started Guide does not work

See original GitHub issue

The context

The guide gives an example of a gradle build file here: https://yidongnan.github.io/grpc-spring-boot-starter/en/server/getting-started.html

The question

However the resolution of that file files for the first dependency tasks

Stacktraces and logs

FAILURE: Build completed with 2 failures.

1: Task failed with an exception.
-----------
* Where:
Build file '/home/xetra11/Development/projects/user-service/grpc-lib/build.gradle' line: 4

* What went wrong:
A problem occurred evaluating project ':grpc-lib'.
> Could not find method implementation() for arguments [io.grpc:grpc-protobuf:1.35.0] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
==============================================================================

2: Task failed with an exception.
-----------
* What went wrong:
A problem occurred configuring project ':grpc-lib'.
> The com.google.protobuf plugin could not be applied during project evaluation. The Java plugin or one of the Android plugins must be applied to the project first.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
==============================================================================

* Get more help at https://help.gradle.org

BUILD FAILED in 94ms

The application’s environment

The build file:

apply plugin: 'com.google.protobuf'

dependencies {
    compile "io.grpc:grpc-protobuf:1.35.0"
    compile "io.grpc:grpc-stub:1.35.0"
}

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.14'
    }
}

protobuf {
    protoc {
        artifact = "com.google.protobuf:protoc:3.14.0"
    }
    generatedFilesBaseDir = "$projectDir/src/generated"
    clean {
        delete generatedFilesBaseDir
    }
    plugins {
        grpc {
            artifact = "io.grpc:protoc-gen-grpc-java"
        }
    }
    generateProtoTasks {
        all()*.plugins {
            grpc {}
        }
    }
}

buildscript {
    dependencies {
        classpath "com.google.protobuf:protobuf-gradle-plugin:0.8.14"
    }
}

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:13

github_iconTop GitHub Comments

1reaction
xetra11commented, Jan 16, 2021

@ST-DDT Thank god now it works. You saved my day ❤️

1reaction
ST-DDTcommented, Jan 16, 2021

Sorry for stating the wrong version. You have to use jakarta.annotation-api v1.3.5. v2.0.0 changed the class names. For some strange reason, it did work in my previous tests though (maybe it was cached in the gradle daemon or maybe I just used J8…)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Troubleshooting builds - Gradle User Manual
If you followed the installation instructions, and aren't able to execute your Gradle build, here are some tips that may help. If you...
Read more >
Getting Started | Building Java Projects with Gradle - Spring
Run gradle tasks again, and you see new tasks added to the list, including tasks for building the project, creating JavaDoc, and running...
Read more >
Getting Started with Gradle | IntelliJ IDEA Documentation
In this tutorial, we'll create a Gradle project, will run and test it, and run the executable JAR file using Gradle.
Read more >
Using the Gradle build system in the Eclipse IDE - Tutorial
Eclipse does not automatically update the classpath, if the build.gradle file is updated. Select Gradle Refresh Gradle Project from the context ...
Read more >
Gradle tutorial for complete beginners - Tom Gregory
Have you heard of Gradle, but you're not really sure what it is, why you should use it, and how to get started?...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found