axeon
03/17/2024, 7:52 AMgradle publish
, only a .jar
file gets published. Afaik, it's necessary to include a .klib
as well for it to be used in other Native projects, and the problem is that publishing does not generate/upload that .klib
file.
Build file:
https://github.com/reblast/KPresence/blob/master/build.gradle.ktsMichael Paus
03/17/2024, 8:38 AMpublishToMavenLocal
for example? This generates all the jars
and klibs
for all targets I need.Adam S
03/17/2024, 9:08 AMpublishing {
repositories {
maven(file("build/dev-maven")) {
name = "DevMaven"
}
}
Then you can run gradle publishAllToDevMaven
and check the directory. It's nicer because you can view the files in IJ rather than digging through ~/.m2
, and you can more easily delete & retry.axeon
03/17/2024, 11:33 AMpublishToMavenLocal
did generate the klib files.axeon
03/17/2024, 11:35 AMpublish
but faced an error, seems like its not creating separate packages for each target:Adam S
03/17/2024, 11:41 AMpublications {
withType<MavenPublication> {
artifact(javadocJar)
pom {
groupId = "me.blast"
artifactId = "kpresence"
version = project.version.toString()
Adam S
03/17/2024, 11:42 AMme.blast:kpresence-macos:1.2.3
, me.blast:kpresence-linux:1.2.3
, me.blast:kpresence-mingw:1.2.3
, etcAdam S
03/17/2024, 11:44 AMbuild.gradle.kts
project.version = "1.2.3"
project.group = "me.blast"
Or in gradle.properties
version=1.2.3
group=me.blast
And Gradle will automatically pick those up, and use them for the Maven publicationsaxeon
03/17/2024, 11:45 AMaxeon
03/17/2024, 11:45 AMAdam S
03/17/2024, 11:47 AMbuild.gradle.kts
https://github.com/reblast/KPresence/blob/72cc3ebbd9e08b1eabafb4518b56e80180bcf8c7/build.gradle.kts#L13-L14, so you can just remove the manual override from the MavenPublications :)axeon
03/17/2024, 11:52 AMaxeon
03/17/2024, 11:53 AMAdam S
03/17/2024, 11:57 AMaxeon
03/17/2024, 12:03 PMaxeon
03/17/2024, 12:06 PMaxeon
03/17/2024, 12:08 PMmaven {
name = "OSS"
val releasesRepoUrl = uri("<https://oss.sonatype.org/service/local/staging/deployByRepositoryId/${project.findProperty(>"sonatype.repository")}/")
val snapshotsRepoUrl = uri("<https://oss.sonatype.org/content/repositories/snapshots/>")
url = if (version.toString().endsWith("SNAPSHOT")) snapshotsRepoUrl else releasesRepoUrl
credentials {
username = project.findProperty("sonatype.username") as String? ?: System.getenv("SONATYPE_USERNAME")
password = project.findProperty("sonatype.password") as String? ?: System.getenv("SONATYPE_PASSWORD")
}
}
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':publishKotlinMultiplatformPublicationToOSSRepository'.
Failed to publish publication 'kotlinMultiplatform' to repository 'OSS'
> Could not PUT '<https://oss.sonatype.org/service/local/staging/deployByRepositoryId/kpresence/io/github/reblast/kpresence/0.2.1/kpresence-0.2.1.jar>'. Received status code 401 from server: Unauthorized
axeon
03/17/2024, 12:13 PMmaven2
instead of deployByRepositoryId
? is there any difference?Adam S
03/17/2024, 12:52 PMAdam S
03/17/2024, 12:52 PMmaven-publish
plugin.axeon
03/17/2024, 12:54 PMaxeon
03/17/2024, 12:55 PMAdam S
03/17/2024, 12:55 PMAdam S
03/17/2024, 12:57 PMaxeon
03/17/2024, 3:04 PMAdam S
03/17/2024, 3:16 PM