When I build and publish my multiplatform library ...
# multiplatform
j
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
try rename the
library
module
j
@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
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