antlr-kotlin icon indicating copy to clipboard operation
antlr-kotlin copied to clipboard

Dependency not found for the Gradle plugin

Open softwarehangar7 opened this issue 6 years ago • 3 comments

Ciao Federico,

I tried to use the Gradle plugin it seems that it cannot find a dependency on antlr-kotlin-target.

Should I add another repository URL to satisfy this?

Regards,

Luigi

softwarehangar7 avatar Jun 25 '19 23:06 softwarehangar7

@unosviluppatore is working on getting this fixed. Sorry for the late answer

ftomassetti avatar Jul 01 '19 17:07 ftomassetti

@softwarehangar7 can you add the gradle file that you have used? Please also have a look at https://github.com/Strumenta/antlr-kotlin/blob/master/antlr-kotlin-examples-jvm/build.gradle.kts, maybe it is already fixed in the new version 0.0.5.

drieks avatar Sep 17 '19 17:09 drieks

Thank you for this great project! I googled antlr multiplatform without expecting the existence, but here it is!!!

Though, I also found that I can't resolve dependencies using jitpack. More specifically, I tried to use 2e25fd5, but it seems to me that there is a problem on the module file of that version, where it points the version and the URL including 0.0.5 which doesn't exist in jitpack. I tried dependency substitution to substitute 0.0.5 into 2e25fd5 as well, but it didn't affect the URL of artifacts.

I eventually found that the following works, but it's not elegant.

open fold
classpath("com.strumenta.antlr-kotlin:antlr-kotlin-target:$antlrKotlinVersion") {
    artifact {
        name = [email protected]
        extension = "jar"
        type = "jar"
        url = "https://jitpack.io/com/strumenta/antlr-kotlin/${[email protected]}/$antlrKotlinVersion/${[email protected]}-$antlrKotlinVersion.jar"
    }
}
classpath("com.strumenta.antlr-kotlin:antlr-kotlin-gradle-plugin:$antlrKotlinVersion") {
    exclude(group = "com.strumenta.antlr-kotlin", module = "antlr-kotlin-target")
    artifact {
        name = [email protected]
        extension = "jar"
        type = "jar"
        url = "https://jitpack.io/com/strumenta/antlr-kotlin/${[email protected]}/$antlrKotlinVersion/${[email protected]}-$antlrKotlinVersion.jar"
    }
}
// and we need more for the runtime dependencies

Another workaround I found is; submodulify this entire git repository and include this project from my project, plus dependency substitution like the following, which might be slightly better than the above solution.

// settings.gradle.kts
includeBuild("./antlr-kotlin") {
    dependencySubstitution {
        val modules = arrayOf(
            "antlr-kotlin-gradle-plugin",
            "antlr-kotlin-target",
            "antlr-kotlin-runtime"
        )
        for (module in modules) {
            substitute(module("com.strumenta.antlr-kotlin:$module"))
                .with(project(":$module"))
        }
    }
}

MiSawa avatar Sep 29 '19 08:09 MiSawa

Now the project is published on Maven Central, and therefore it should be easier to get the dependency. Sorry that it took a while

ftomassetti avatar Dec 22 '23 12:12 ftomassetti