reduxkotlin/redux-kotlin

Execution failed for task compileKotlinJs

EmmanueleVilla opened this issue · 5 comments

Hi, I'm trying to develop a sample-app using kotlin multiplatform and redux-kotlin but I'm struggling to setup the library for a new multiplatform project. I've created a "Kotlin/Multiplatform" project from IntelliJ 2019.3.2

This is my gradle file:

plugins {
    id 'java'
    id 'org.jetbrains.kotlin.multiplatform' version '1.3.61'
}
group 'com.shadowings'
version '1.0.0'
sourceCompatibility = 1.8
repositories {
    mavenCentral()
}
dependencies {
    testCompile group: 'junit', name: 'junit', version: '4.12'
}
kotlin {
    jvm()
    js()
    iosArm64("ios") {
        binaries {
            framework()
        }
    }
    iosX64("iosSim") {
        binaries {
            framework()
        }
    }
    sourceSets {
        commonMain {
            dependencies {
                implementation kotlin('stdlib-common')
                implementation kotlin("org.reduxkotlin:redux-kotlin:0.4.0")
            }
        }
        commonTest {
            dependencies {
                implementation kotlin('test-common')
                implementation kotlin('test-annotations-common')
            }
        }
        jvmMain {
            dependencies {
                implementation kotlin('stdlib-jdk8')
            }
        }
        jvmTest {
            dependencies {
                implementation kotlin('test')
                implementation kotlin('test-junit')
            }
        }
        jsMain {
            dependencies {
                implementation kotlin('stdlib-js')
            }
        }
        jsTest {
            dependencies {
                implementation kotlin('test-js')
            }
        }
        iosSimMain.dependsOn iosMain
        iosSimTest.dependsOn iosTest
    }
}

And I have this error when I try to build:

Execution failed for task ':compileKotlinJs'.
- Could not resolve all files for configuration ':jsCompileClasspath'.
   - Could not find org.jetbrains.kotlin:kotlin-org.reduxkotlin:redux-kotlin.
     Searched in the following locations:
       - https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-org.reduxkotlin/redux-kotlin/kotlin-org.reduxkotlin-redux-kotlin.module
       - https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-org.reduxkotlin/redux-kotlin/kotlin-org.reduxkotlin-redux-kotlin.pom
     Required by:
         project :

Possible solution:
 - Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html

You can find the whole project at this repository: https://github.com/EmmanueleVilla/themoviedb-kotlinmultiplatform

Maybe change this line:
implementation kotlin("org.reduxkotlin:redux-kotlin:0.4.0")

to
implementation("org.reduxkotlin:redux-kotlin:0.4.0")

Thanks that fixed it! I saw that the other libraries were imported that way, so..
I also needed to upgrade gradle to your version to match the metadata version.
Anyway, I still have a problem.. The gradle build succeded but I still can't use the library because I can't see it, like it isn't present in the gradle file.. I have no "org.xxx" namespace to be imported.
Do you have any clue?

@EmmanueleVilla hmm, that is odd. Are you still having this problem? Is this project a multi-module project? If so is the lib imported into the module you are referring to?

@patjackson52 yes, I still have this problem, you can see it in the repository that I've shared in my first comment.
Anyway, I've abandoned that repository and initialized a new one using kampkit, and in that project I can succesfully import your library, so maybe I've just messed up some gradle in the first repo :)

Good to hear. closing this ticket as it seems to be an environment issue.