Kotlin-多平台-在Bintray上上传发布后,Gradle depedencies上没有下载Jar文件。

问题描述 投票:0回答:1

我能够在bintray上发布我的作品,当我在一个测试项目上尝试时,我的作品就会被发布。

repositories {
  maven("https://dl.bintray.com/user/libraries/")
}

dependencies { 
   implementation("com.user.project:project-name:version")
}

我在Gradle构建时没有得到任何错误。

我可以看到我的jar文件在 https://dl.bintray.com/user/libraries/

com/
  user/
     project/
           projec-name/
             | -- maven-metadata.xml
             | -- version
                     | -- pom.xml
                     | -- project-name-version-jvm.jar
                     | -- project-name-meta-data-version-sources.jar
                     | -- project-name-meta-data-version.jar

上传到bintray上好像没什么问题

在IntelliJ的右侧窗格中的Gradle标签下,项目被列于 runtimeClassPath但不在 compileClassPath 也没有下载任何jar文件从 External Dependencies

这是我的

build.gradle.kts

publishing {
    publications {
        create<MavenPublication>("project-name") {
            pom {
                name.set("project-name")
                description.set("My project descriptoin")
                url.set("https://github.com/user/project-name")

                licenses {
                    license {
                        name.set("Apache License 2.0")
                        url.set("https://github.com/user/project-name/blob/master/LICENSE")
                    }
                }
                developers {
                    developer {
                        id.set("user")
                        name.set("user")
                    }
                }
                scm {
                    connection.set("scm:git:git://github.com/user/project-name.git")
                    url.set("https://github.com/user/project-name")
                }
            }
        }
    }
}

bintray {
    user = "user"
    key = "key"

    pkg(delegateClosureOf<BintrayExtension.PackageConfig> {
        repo = "libraries"
        name = "project-name"
        userOrg = "user"
        setPublications("project-name") // should be same as set in Maven Publication above
        filesSpec(delegateClosureOf<CopySpec> {
            from("build/libs/")
            into("com/user/project/project-name/version") // this i think where the issue is, altho can't verify
        })

    })
}

但为什么我通过依赖关系把它放到我的项目上时,却得不到任何jars。

我将非常感谢一些关于我哪里做错了的见解。

额外问题: 如果我现在只针对JVM,那么,除了用下面的方法,删除所有其他罐子是安全的吗?jvm 作为后缀。

gradle bintray kotlin-multiplatform
1个回答
0
投票

上传的工件与Maven布局不匹配。

主工件应该被称为 project-name-version.jar. 存在 -meta-data 源码中的JAR和备用JAR也意味着它们不会被认为是带有Maven分类器的存档。

也就是说Gradle应该抱怨找不到那个JAR。

你用哪个任务来测试消费?

© www.soinside.com 2019 - 2024. All rights reserved.