Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Could not find io.confluent:kafka-protobuf-serializer:6.0.0

The straight question is: why is Gradle not resolving this dependency I added

dependencies {

    //kafka-protobuf-serializer
    implementation("io.confluent:kafka-protobuf-serializer:6.0.0")
}

?

Accoring to mvn this is how I add such dependency in my build.gradle

compile group: 'io.confluent', name: 'kafka-protobuf-serializer', version: '6.0.0'

All my other dependencies are added with "implementation ...". So far so good. But for this speficic I got

Execution failed for task ':extractIncludeProto'.
> Could not resolve all files for configuration ':compileProtoPath'.
   > Could not find io.confluent:kafka-protobuf-serializer:6.0.0.
     Searched in the following locations:
       - file:/C:/Users/Cast/.m2/repository/io/confluent/kafka-protobuf-serializer/6.0.0/kafka-protobuf-serializer-6.0.0.pom
       - https://jcenter.bintray.com/io/confluent/kafka-protobuf-serializer/6.0.0/kafka-protobuf-serializer-6.0.0.pom
     Required by:
         project :

Possible solution:
 - Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html

What I am missing or messing here?

Here is the whole build.gradle

plugins {
    id "org.jetbrains.kotlin.jvm" version "1.3.72"
    id "org.jetbrains.kotlin.kapt" version "1.3.72"
    id "org.jetbrains.kotlin.plugin.allopen" version "1.3.72"
    id "application"
    id 'com.google.protobuf' version '0.8.13'
}

version "0.2"
group "account-control"

repositories {
    mavenLocal()
    jcenter()
}

configurations {
    // for dependencies that are needed for development only
    developmentOnly
}

dependencies {
    kapt(enforcedPlatform("io.micronaut:micronaut-bom:$micronautVersion"))
    kapt("io.micronaut:micronaut-inject-java")
    kapt("io.micronaut:micronaut-validation")

    implementation(enforcedPlatform("io.micronaut:micronaut-bom:$micronautVersion"))
    implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:${kotlinVersion}")
    implementation("org.jetbrains.kotlin:kotlin-reflect:${kotlinVersion}")
    implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlinxCoroutinesVersion")
    implementation("io.micronaut:micronaut-runtime")
//    implementation("io.micronaut.grpc:micronaut-grpc-runtime")
    implementation("io.micronaut.grpc:micronaut-grpc-server-runtime:$micronautGrpcVersion")
    implementation("io.micronaut.grpc:micronaut-grpc-client-runtime:$micronautGrpcVersion")
    implementation("io.grpc:grpc-kotlin-stub:${grpcKotlinVersion}")

    //Kafka
    implementation("io.micronaut.kafka:micronaut-kafka")

    //vertx
    implementation("io.micronaut.sql:micronaut-vertx-mysql-client")
    //implementation("io.micronaut.configuration:micronaut-vertx-mysql-client")
    compile 'io.vertx:vertx-lang-kotlin:3.9.4'

    //mongodb
    implementation("org.mongodb:mongodb-driver-reactivestreams:4.1.1")

    //kafka-protobuf-serializer
    implementation("io.confluent:kafka-protobuf-serializer:6.0.0")

    runtimeOnly("ch.qos.logback:logback-classic:1.2.3")
    runtimeOnly("com.fasterxml.jackson.module:jackson-module-kotlin:2.9.8")

    kaptTest("io.micronaut:micronaut-inject-java")

    testImplementation enforcedPlatform("io.micronaut:micronaut-bom:$micronautVersion")
    testImplementation("org.junit.jupiter:junit-jupiter-api:5.3.0")
    testImplementation("io.micronaut.test:micronaut-test-junit5")
    testImplementation("org.mockito:mockito-junit-jupiter:2.22.0")

    testRuntime("org.junit.jupiter:junit-jupiter-engine:5.3.0")
    testRuntime("org.jetbrains.spek:spek-junit-platform-engine:1.1.5")
}

test.classpath += configurations.developmentOnly

mainClassName = "account-control.Application"

test {
    useJUnitPlatform()
}

allOpen {
    annotation("io.micronaut.aop.Around")
}

compileKotlin {
    kotlinOptions {
        jvmTarget = '11' 
        //Will retain parameter names for Java reflection
        javaParameters = true 
    }
}
//compileKotlin.dependsOn(generateProto)

compileTestKotlin {
    kotlinOptions {
        jvmTarget = '11' 
        javaParameters = true 
    }
}

tasks.withType(JavaExec) {
    classpath += configurations.developmentOnly
    jvmArgs('-XX:TieredStopAtLevel=1', '-Dcom.sun.management.jmxremote')
}

sourceSets {
    main {
        java {
            srcDirs 'build/generated/source/proto/main/grpc'
            srcDirs 'build/generated/source/proto/main/grpckt'
            srcDirs 'build/generated/source/proto/main/java'
        }
    }
}

protobuf {
    protoc { artifact = "com.google.protobuf:protoc:${protocVersion}" }
    plugins {
        grpc { artifact = "io.grpc:protoc-gen-grpc-java:${grpcVersion}" }
        grpckt { artifact = "io.grpc:protoc-gen-grpc-kotlin:${grpcKotlinVersion}" }
    }
    generateProtoTasks {
        all()*.plugins {
            grpc {}
            grpckt {}
        }
    }
}

*** first edition

    Execution failed for task ':extractIncludeProto'.
    > Could not resolve all files for configuration ':compileProtoPath'.
       > Could not resolve com.squareup.wire:wire-schema:3.2.2.
         Required by:
             project : > io.confluent:kafka-protobuf-serializer:6.0.0 > io.confluent:kafka-protobuf-provider:6.0.0
          > The consumer was configured to find a component, preferably only the resources files. However we cannot choose between the following variants of com.squareup.wire:wire-schema:3.2.2:
              - jvm-api
              - jvm-runtime
              - metadata-api
            All of them match the consumer attributes:
              - Variant 'jvm-api' capability com.squareup.wire:wire-schema:3.2.2 declares a component, packaged as a jar:
                  - Unmatched attributes:
                      - Provides release status but the consumer didn't ask for it
                      - Provides an API but the consumer didn't ask for it
                      - Provides attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm' but the consumer didn't ask for it
              - Variant 'jvm-runtime' capability com.squareup.wire:wire-schema:3.2.2 declares a component, packaged as a jar:
                  - Unmatched attributes:
                      - Provides release status but the consumer didn't ask for it
                      - Provides a runtime but the consumer didn't ask for it
                      - Provides attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm' but the consumer didn't ask for it
              - Variant 'metadata-api' capability com.squareup.wire:wire-schema:3.2.2:
                  - Unmatched attributes:
                      - Doesn't say anything about its elements (required them preferably only the resources files)
                      - Provides release status but the consumer didn't ask for it
                      - Provides a usage of 'kotlin-api' but the consumer didn't ask for it
                      - Provides attribute 'org.jetbrains.kotlin.platform.type' with value 'common' but the consumer didn't ask for it
    
    * Try:
    Run with --info or --debug option to get more log output. Run with --scan to get full insights.
    
    * Exception is:
    org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':extractIncludeProto'.
        at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:38)
        at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.executeTask(EventFiringTaskExecuter.java:77)
        at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:55)
        at 
...

        at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:56)
    Caused by: org.gradle.internal.resolve.ModuleVersionResolveException: Could not resolve com.squareup.wire:wire-schema:3.2.2.
    Required by:
        project : > io.confluent:kafka-protobuf-serializer:6.0.0 > io.confluent:kafka-protobuf-provider:6.0.0
    Caused by: org.gradle.internal.component.AmbiguousConfigurationSelectionException: The consumer was configured to find a component, preferably only the resources files. However we cannot choose between the following variants of com.squareup.wire:wire-schema:3.2.2:
      - jvm-api
      - jvm-runtime
      - metadata-api
    All of them match the consumer attributes:
      - Variant 'jvm-api' capability com.squareup.wire:wire-schema:3.2.2 declares a component, packaged as a jar:
          - Unmatched attributes:
              - Provides release status but the consumer didn't ask for it
              - Provides an API but the consumer didn't ask for it
              - Provides attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm' but the consumer didn't ask for it
      - Variant 'jvm-runtime' capability com.squareup.wire:wire-schema:3.2.2 declares a component, packaged as a jar:
          - Unmatched attributes:
              - Provides release status but the consumer didn't ask for it
              - Provides a runtime but the consumer didn't ask for it
              - Provides attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm' but the consumer didn't ask for it
      - Variant 'metadata-api' capability com.squareup.wire:wire-schema:3.2.2:
          - Unmatched attributes:
              - Doesn't say anything about its elements (required them preferably only the resources files)
              - Provides release status but the consumer didn't ask for it
              - Provides a usage of 'kotlin-api' but the consumer didn't ask for it
              - Provides attribute 'org.jetbrains.kotlin.platform.type' with value 'common' but the consumer didn't ask for it
        at org.gradle.internal.component.model.AttributeConfigurationSelector.selectConfigurationUsingAttributeMatching(AttributeConfigurationSelector.java:105)
        at org.gradle.internal.component.model.AttributeConfigurationSelector.selectConfigurationUsingAttributeMatching(AttributeConfigurationSelector.java:108)
        at org.gradle.internal.component.model.AttributeConfigurationSelector.selectConfigurationUsingAttributeMatching(AttributeConfigurationSelector.java:51)
        at org.gradle.internal.component.external.model.ConfigurationBoundExternalDependencyMetadata.selectConfigurations(ConfigurationBoundExternalDependencyMetadata.java:98)
        at org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.builder.EdgeState.calculateTargetConfigurations(EdgeState.java:253)
        at org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.builder.EdgeState.attachToTargetConfigurations(EdgeState.java:153)
        at ...org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
        at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48)
        at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:56)
like image 982
Jim C Avatar asked Dec 09 '20 09:12

Jim C


1 Answers

When using mvnrepository.com, take note of which repository the module is available in as you only have JCenter configured for your build (which is usually fine, just not in this case). Here the dependency is in the Confluent repository:

MvnRepository information

So you will need to add this repository to your build:

repositories {
    mavenLocal()
    jcenter()
    maven { url "https://packages.confluent.io/maven/" }
}
like image 177
Bjørn Vester Avatar answered Sep 19 '22 15:09

Bjørn Vester