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

Shan

04/04/2019, 8:48 PM
Hey all. Is there a way to publish the artifacts generated from commonMain to Maven? And if so, should I be actually uploading the artifacts from commonMain to Maven? I might be thinking about this incorrectly, but if, for example, someone were to make a separate multiplatform project and wanted to call methods in their common code from my multiplatform project's common code. Is there a different way they should be doing this other than to have a dependency on my project's common code?
s

serebit

04/04/2019, 8:50 PM
well first, the artifact you'd be uploading would be called
metadata
, not
common
. second, yes, you should
s

Shan

04/04/2019, 8:52 PM
ooh, that's what the metadata bit is for! so I just call it with the
val metadata by getting {}
format within publications block?
s

serebit

04/04/2019, 8:53 PM
yeah, the artifact produced from the
common
source set is called
metadata
. there's a reason for that, but it's not explained very well in the docs. you can access it like that, yes
p

pardom

04/04/2019, 8:53 PM
Eh, probably want to use
commonMain
and
commonTest
, but yes
val target by getting {}
s

serebit

04/04/2019, 8:53 PM
@pardom the source sets are called
commonMain
and
commonTest
, the artifact is called
metadata
s

Shan

04/04/2019, 8:54 PM
^ that was what was confusing to me. project can find the publication fine now 🙂 thanks!
👍🏿 1
p

pardom

04/04/2019, 8:57 PM
Ah, I missed the
publications
part of her question and assumed she was working in
sourceSets
.
BTW, that script I posted will publish metadata to
foo
and
foo-metadata
2 Views