【问题标题】:No signature of method is applicable for argument types when trying to publish to JCenter with gradle尝试使用 gradle 发布到 JCenter 时,没有方法签名适用于参数类型
【发布时间】:2020-08-31 12:49:25
【问题描述】:

我正在尝试使用 gradle 将我的项目发布到 JCenter。

我收到此错误:

$ ./gradlew bintrayUpload

FAILURE: Build failed with an exception.

* Where:
Build file '/Users/tomcaflisch/my-project/build.gradle' line: 32

* What went wrong:
A problem occurred evaluating root project 'my-project'.
> No signature of method: build_1izvkzzfcfkppgubyut54udzf.bintray() is applicable for argument types: (build_1izvkzzfcfkppgubyut54udzf$_run_closure3) values: [build_1izvkzzfcfkppgubyut54udzf$_run_closure3@30577a07]

* 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 1s

这是我的build.gradle 文件

buildscript {
    repositories {
        maven { url "https://repo1.maven.org/maven2" }
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.3.+'
        classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
    }
}

plugins {
    id "com.jfrog.bintray" version "1.8.5"
}

apply plugin: 'idea'
apply plugin: 'eclipse'
apply plugin: 'java'

group = 'com.projectx'
version = '0.0.1'

repositories {
    jcenter()
    mavenCentral()
}

sourceSets {
    main.java.srcDirs = ['src/main/java']
}

bintray {
    user = System.getenv('BINTRAY_USER')
    key = System.getenv('BINTRAY_KEY')
    publications = ['MyPublication']
    pkg {
        repo = 'maven'
        name = 'project-x'
        userOrg = 'myorg'
        licenses = ['Proprietary']
        vcsUrl = 'https://github.com/myorg/my-project.git'
        version {
            name = project.version
            released new Date()
        }
    }
}

publishing {
    publications {
        MyPublication(MavenPublication) {
            from components.java
            groupId project.group
            artifactId 'projectx'
            version project.version
        }
    }
}

apply plugin: 'java'
apply plugin: 'maven'
apply plugin: 'jacoco'

sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8

install {
    repositories.mavenInstaller {
        pom.artifactId = 'projectx'
    }
}

test {
    finalizedBy jacocoTestReport   // Report is always generated after tests run
}

jacocoTestReport {
    dependsOn test  // Tests are required to run before generating the report
    reports {
        xml.enabled true
    }
}

task execute(type:JavaExec) {
    main = System.getProperty('mainClass')
    classpath = sourceSets.main.runtimeClasspath
}

dependencies {
    compile 'io.swagger:swagger-annotations:1.5.22'
    compile "com.google.code.findbugs:jsr305:3.0.2"
    compile 'com.squareup.okhttp3:okhttp:3.14.2'
    compile 'com.squareup.okhttp3:logging-interceptor:3.14.2'
    compile 'com.google.code.gson:gson:2.8.5'
    compile 'io.gsonfire:gson-fire:1.8.3'
    compile group: 'org.apache.commons', name: 'commons-lang3', version: '3.9'
    testCompile 'junit:junit:4.13'
    testCompile 'org.mockito:mockito-core:3.+'
    testImplementation "com.google.truth:truth:1.0.1"
}

javadoc {
    options.tags = [ "http.response.details:a:Http Response Details" ]
}

【问题讨论】:

  • 什么版本的gradle?
  • 还有project.pluginManager.hasPlugin('com.jfrog.bintray')的输出是什么?
  • Gradle 6.3.0。我会在哪里看到该输出?
  • 您应该可以在build.gradle 中的任何位置打印此内容,然后只需运行gradle 即可查看输出

标签: java gradle jcenter


【解决方案1】:

Bintray 死了。 但要回答这个问题,No signature of method: build_whatever.[method]() 来自 [method] 配置中的某些内容不正确。在这种情况下,我猜它是由released new Date() 引起的,应该是released = new Date()

【讨论】:

    猜你喜欢
    • 2017-07-05
    • 2021-11-02
    • 1970-01-01
    • 1970-01-01
    • 2017-11-15
    • 1970-01-01
    • 2017-06-19
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多