Edouard Goossens
02/04/2019, 2:35 PMh0tk3y
02/04/2019, 2:56 PMWith maven-publishing plugin it will run
./gradlew build publishToMavenLocalSo I think it should include the
*.module
files, too. Does it not?Edouard Goossens
02/04/2019, 3:26 PMh0tk3y
02/04/2019, 3:30 PMEdouard Goossens
02/04/2019, 3:34 PMConfigure project :Kotlin Multiplatform Projects are an experimental feature.
Task :compileKotlinJs FAILEDFAILURE: Build failed with an exception. * What went wrong: Execution failed for task ‘:compileKotlinJs’.
Could not resolve all files for configuration ‘:jsCompileClasspath’.> Could not resolve com.github.egoossens.firestore-kotlin-mppbuild jvm3c94011c06. Required by: project : > com.github.egoossensfirestore kotlin mpp3c94011c06 > Unable to find a matching variant of com.github.egoossens.firestore-kotlin-mppbuild jvm3c94011c06: - Variant ‘jvm-api’: - Found artifactType ‘jar’ but wasn’t required. - Found org.gradle.status ‘release’ but wasn’t required. - Required org.gradle.usage ‘kotlin-api’ and found compatible value ‘java-api’. - Required org.jetbrains.kotlin.platform.type ‘js’ and found incompatible value ‘jvm’. - Variant ‘jvm-runtime’: - Found artifactType ‘jar’ but wasn’t required. - Found org.gradle.status ‘release’ but wasn’t required. - Required org.gradle.usage ‘kotlin-api’ and found compatible value ‘java-runtime-jars’. - Required org.jetbrains.kotlin.platform.type ‘js’ and found incompatible value ‘jvm’. - Variant ‘metadata-api’: - Found artifactType ‘jar’ but wasn’t required. - Found org.gradle.status ‘release’ but wasn’t required. - Required org.gradle.usage ‘kotlin-api’ and found compatible value ‘kotlin-api’. - Required org.jetbrains.kotlin.platform.type ‘js’ and found incompatible value ‘common’. > Could not resolve com.github.egoossens.firestore-kotlin-mppbuild metadata3c94011c06. Required by: project : > com.github.egoossensfirestore kotlin mpp3c94011c06 > Unable to find a matching variant of com.github.egoossens.firestore-kotlin-mppbuild metadata3c94011c06: Variant ‘metadata-api’: - Found artifactType ‘jar’ but wasn’t required. - Found org.gradle.status ‘release’ but wasn’t required. - Required org.gradle.usage ‘kotlin-api’ and found compatible value ‘kotlin-api’. - Required org.jetbrains.kotlin.platform.type ‘js’ and found incompatible value ‘common’. * Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights. * Get more help at https://help.gradle.org
h0tk3y
02/04/2019, 3:39 PMcom.github.egoossens.firestore-kotlin-mpp:build-jvm:3c94011c06
and com.github.egoossens.firestore-kotlin-mpp:build-metadata:3c94011c06
? This is what the log looks like: it says Gradle tried to resolve a dependency on com.github.egoossens.firestore-kotlin-mpp:build-jvm:...
for a JS consumer (jsCompileClasspath
), which failed quite as expected. Did you try to replace them with a single dependency on com.tastyelectrons.firestore-kotlin-mpp:build:...
?Build artifacts: ...
part of the JitPack output tells me the library must have published correctly, with com.github.egoossens.firestore-kotlin-mpp:build:3c94011c06
being the 'root' module's coordinates. This is the module which you should specify as a dependency, so that Gradle will choose one of its variant for each of the platforms.Edouard Goossens
02/04/2019, 3:43 PMh0tk3y
02/04/2019, 3:45 PMEdouard Goossens
02/04/2019, 3:47 PMh0tk3y
02/04/2019, 3:50 PMcommonMain {
dependencies {
implementation 'com.github.egoossens.firestore-kotlin-mpp:build:3c94011c06'
}
}
Note that it references the module named build
with no platform suffix (not build-jvm
or build-js
). The dependency kind, api
or implementation
, doesn't make difference, both should work.Edouard Goossens
02/04/2019, 3:52 PMh0tk3y
02/04/2019, 3:54 PM{
"name": "js-api",
"attributes": {
"artifactType": "jar",
"org.gradle.usage": "kotlin-api",
"org.jetbrains.kotlin.platform.type": "js"
},
"available-at": {
"url": "../../build-js/0.1.0/build-js-0.1.0.module",
"group": "com.tastyelectrons.firestore-kotlin-mpp",
"module": "build-js",
"version": "0.1.0"
}
},
available-at
part is a hint for Gradle on where to look for the platform module, and here, it clearly doesn't match the repository layout.Edouard Goossens
02/04/2019, 3:56 PMh0tk3y
02/04/2019, 3:58 PMEach build will have these environment variables:
...
And the following project specific environment variables:
* VERSION=<version being built> # A tag or commitSo I guess you may set the project version as follows:
version = System.getenv("VERSION")
This should solve the versions mismatch.Edouard Goossens
02/04/2019, 4:05 PMgroup = "com.tastyelectrons.firestore-kotlin-mpp"
but my JitPack urls use com/github/egoossens...h0tk3y
02/04/2019, 4:17 PMEdouard Goossens
02/04/2019, 4:17 PM<https://jitpack.io/com/tastyelectrons/firestore-kotlin-mpp/build-js/4bf33d302c/build-js-4bf33d302c.module>
but the file is at
<https://jitpack.io/com/github/egoossens/firestore-kotlin-mpp/build-js/4bf33d302c/build-js-4bf33d302c.module>
h0tk3y
02/04/2019, 4:20 PMEdouard Goossens
02/04/2019, 4:20 PMh0tk3y
02/04/2019, 4:26 PMavailable-at
part:
{
"name": "js-api",
"attributes": {
"artifactType": "jar",
"org.gradle.usage": "kotlin-api",
"org.jetbrains.kotlin.platform.type": "js"
},
"available-at": {
"url": "../../build-js/4bf33d302c/build-js-4bf33d302c.module",
"group": "com.tastyelectrons.firestore-kotlin-mpp",
"module": "build-js",
"version": "4bf33d302c"
}
},
Maybe they must always match. I personally didn't try to publish a module under mismatching Maven coordinates, so thanks for sharing your experience, that definitely needs to be taken into consideration.Edouard Goossens
02/04/2019, 4:29 PMh0tk3y
02/04/2019, 4:30 PMEdouard Goossens
02/04/2019, 4:43 PMh0tk3y
02/04/2019, 4:43 PM