https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
j

Jeff Tycz

02/10/2021, 12:36 AM
When I build and publish my multiplatform library to my maven repo the artifact name that gets created is the name of the module in the project example:
Copy code
com.tycz:library-android:0.2.0
Where
library
is the module name in the project I want to change it to something like this
Copy code
com.tycz:myProject-android:0.2.0
How can I change the artifact name?
m

mdabrowski89

02/10/2021, 7:27 AM
try rename the
library
module
j

Joost Klitsie

02/10/2021, 8:46 AM
@mdabrowski89 that sounds like a suboptimal solution
I can find this on the interwebz: groovy
Copy code
afterEvaluate {
    project.publishing.publications.all {
        groupId = group
        if (it.name.contains('metadata')) {
            artifactId = "$libraryName"
        } else {
            artifactId = "$libraryName-$name"
        }
    }
}
kotlin
Copy code
afterEvaluate {
    publishing.publications.all {
        this as MavenPublication
        artifactId = project.name + "-$name".takeUnless { "metadata" in name }.orEmpty()
    }
}
I think you can try to replace the
project.name
part with your own name
locally I see that the names in my local repo change
j

Jeff Tycz

02/11/2021, 12:06 AM
While I am able to change the project name with that, it also incorrectly sets the framework name. Now I get
myLibrary-androidRelease
and
myLibrary-kotlinMultiplatform
2 Views