编程语言
首页 > 编程语言> > java-Gradle无法检测到osdetector插件

java-Gradle无法检测到osdetector插件

作者:互联网

我正在为使用gradle的Java GRPC项目使用OpenSSL.

我读了documetation,其中提到我们应该像该link中所述进行安全设置.

我已经将osdetector插件包含在build.gradle文件中.

但是当我构建项目时,gradle无法解决osdetector插件并抛出错误

> Failed to apply plugin [id 'com.google.protobuf']
   > Plugin with id 'osdetector' not found.

我的gradle文件如下:

def neo4jVersion = "2.3.3"

apply plugin: 'application'
apply plugin: 'java'
apply plugin: 'com.google.protobuf'
apply plugin: 'idea'
apply plugin: 'com.google.osdetector'

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

protobuf {
    protoc {
        // The version of protoc must match protobuf-java. If you don't depend on
        // protobuf-java directly, you will be transitively depending on the
        // protobuf-java version that grpc depends on.
        artifact = "com.google.protobuf:protoc:3.0.0-beta-2"
    }
    plugins {
        grpc {
            artifact = 'io.grpc:protoc-gen-grpc-java:0.12.0'
        }
    }
    generateProtoTasks {
        all()*.plugins {
            grpc {}
        }
    }
    generatedFilesBaseDir = "$projectDir/src/generated"
}

sourceCompatibility = 1.8

repositories {
    mavenCentral()
}

dependencies {
    testCompile group: 'junit', name: 'junit', version: '4.11'
    compile 'io.grpc:grpc-all:0.12.0'
    compile "org.neo4j:neo4j:${neo4jVersion}"
    compile "org.neo4j:neo4j-ogm-core:2.0.1"
    compile "org.neo4j:neo4j-ogm-http-driver:2.0.1"
    compile 'com.google.apis:google-api-services-storage:v1-rev71-1.22.0'
    compile 'com.fasterxml.jackson.core:jackson-core:2.7.3'
    compile 'com.fasterxml.jackson.core:jackson-annotations:2.7.3'
    compile 'com.fasterxml.jackson.core:jackson-databind:2.7.3'
    compile 'io.netty:netty-tcnative-boringssl-static:1.1.33.Fork14:' + osdetector.classifier
}

但是,仅编译依赖项已得到解决.

我想我在这里缺少一些基本知识.请让我知道解决方案.

更新

解决方法:

protobuf-gradle-plugin is not compatible和osdetector-gradle-plugin-1.4.0,因为该版本更改了插件的名称.交换到版本osdetector 1.2.1应该可以解决此问题.

标签:java,gradle,protocol-buffers,netty,grpc
来源: https://codeday.me/bug/20191011/1895415.html