How can I skip all target except Android for Multiplatform Kotlin library publication to maven?

Andrei Marshalov

I’m using maven-publish to publish my multiplatform library to maven repo. My publishing config looks like:

project.afterEvaluate {
    publishing {
        publications {
            create<MavenPublication>("maven") {
                groupId = projectGroup
                artifactId = projectArtifactName
                version = "${android.defaultConfig.versionName}"
                tasks.getByName("bundle${buildType.capitalize()}Aar").outputs.files.forEach {
                    artifact(it)
                }
            }
        }
        repositories {
            mavenLocal()
        }
    }
}

As a result of publishing i get several modules:

└── repository
    └── com
        └── example
            ├── lib-ios
            │   ├── 1.0.0
            ├── lib-iossim
            │   ├── 1.0.0
            ├── lib-macos
            │   ├── 1.0.0
            ├── lib-metadata
            │   ├── 1.0.0
            └── lib
                ├── 1.0.0

After that i use this library in Android app as:

dependencies {
    implementation("com.example:lib:1.0.0")
}

So it looks like i need to publish to maven only Android part of my library, since i use carthage to publish iOS part.

How can I skip all target except Android for Multiplatform Kotlin library publication to maven?

Webfreak

Check your grade > lib > publishing tasks. There should be:

  1. Publish[module_name]PublicationToMavenLocal and

  2. Publish[module_name]PublicationToMavenRepository

This should publish only Android part of the library.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

How can I query all values except the value created today?

How can I select all children of an element except the last child?

Kotlin MultiPlatform - Publish Android Library Failing

How can I replace all words in a string except one

How can I pad all equal signs in Python except for ==, !=, >=, <=?

How to share Java code between Android and JVM targets (with Kotlin Multiplatform)?

How i can get all products except duplicates?

Julia: in @formula how I specifyc all columns except target?

How can I enable Explcit API mode in an Android/Kotlin library module?

Kotlin Multiplatform Library: Unable to generate .framework for iOS

How can I skip bean validation if all fields for the entity are empty?

How I can create a multiplatform portable pendrive of Ubuntu?

QTreeView with QFileSystemModel: How can I remove all columns except "Name"?

How can I count all rows except duplicate entry of a column?

How can I check all checkboxes except the disabled ones?

How can I get all data via doctrine except one?

how can I add classes to all items except the first four

Kotlin Multiplatform build failure due to android target

Publish kotlin multiplatform library to Maven Central (InvalidMavenPublicationException multiple artifacts with the identical ...)

How to make a multi-module kotlin multiplatform library for iOS?

How can I publish a javadoc.jar file with my Kotlin multiplatform project?

How can I return all the values except for a "null" one in a JSONObject?

Can not start new kotlin multiplatform library with dependency on exposed library

How can I filter out all elements except the newest ones?

javascript as target in kotlin multiplatform library

How can I rewrite all requests except for one specific URI

How To Set Android JVM Target Compability in Kotlin Multiplatform Mobile Project

Is there a way how to add Kotlin Multiplatform target to a published KMP library which does not contain the target artifact?

How can I write a `try`/`except` block that catches all exceptions?