Gradle bintrayUpload 找不到生成的 jar

我正在尝试从 -files 自动生成和部署 Java 库.proto。第一部分,从我的.proto-files 生成 Java 源代码已经工作,并且 Jar-task 生成三个.jar-files:example.jar,example-javadoc.jar和example-sources.jar(in /build/libs)。但是,发布到 Bintray 失败。


plugins {

    id 'java-library'

    id "maven-publish"

    id "com.jfrog.bintray" version "1.8.4"

}


repositories {

    mavenLocal()

    jcenter()

}

dependencies {

    implementation("io.grpc:grpc-netty:1.21.0")

    implementation("io.grpc:grpc-protobuf:1.21.0")

    implementation("io.grpc:grpc-stub:1.21.0")

}


task sourcesJar(type: Jar) {

    archiveClassifier = 'sources'

    from sourceSets.main.allJava

}


task javadocJar(type: Jar) {

    archiveClassifier = 'javadoc'

    from javadoc.destinationDir

}

publishing {

    publications {

        news(MavenPublication) {

            from components.java


            artifact sourcesJar

            artifact javadocJar


            groupId "de.example"

            artifactId "example"

            version "0.0.1-test.1"

        }

    }

}

bintray {

    user = System.getenv("BINTRAY_USER")

    key = System.getenv("BINTRAY_API_KEY")


    publications = ["news"]

    publish = true

    pkg {

        repo = "example-mvn"

        name = "example"

        userOrg = "example"

        licenses = ["Apache-2.0"]


        version {

            name = "0.0.1-test.1"

            vcsTag = "example_0.0.1-test.1"

        }

    }

}

生成的 jar 应该发布到 Bintray 但执行gradle bintrayUpload -DBINTRAY_USER=xxx -DBINTRAY_API_KEY=xxx --stacktrace会产生以下错误:

> Task :publishNewsPublicationToMavenLocal FAILED


FAILURE: Build failed with an exception.


* What went wrong:

Execution failed for task ':publishNewsPublicationToMavenLocal'.

> Failed to publish publication 'news' to repository 'mavenLocal'

   > Failed to install artifact de.example:example:jar:0.0.1-test.1: /home/jowan/.m2/repository/de/example/example/0.0.1-test.1/example-0.0.1-test.1.jar (No such file or directory)


* Try:

Run with --info or --debug option to get more log output. Run with --scan to get full insights.


慕哥6287543
浏览 166回答 1
1回答

森栏

终于找到问题所在:配置工作正常,但在错误的环境中执行。我在 Windows 上工作,但从gradle bintrayUpload -DBINTRAY_USER=xxx -DBINTRAY_API_KEY=xxx --stacktraceUbuntu 子系统调用。从 Windows 中调用它工作正常。
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Java