Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to resolve dependencies #28

Open
snowe2010 opened this issue May 5, 2022 · 8 comments
Open

Unable to resolve dependencies #28

snowe2010 opened this issue May 5, 2022 · 8 comments

Comments

@snowe2010
Copy link

When using

    <dependency>
      <groupId>ai.hypergraph</groupId>
      <artifactId>kotlingrad</artifactId>
      <version>0.4.7</version>
    </dependency>

I'm unable to resolve any ai types.

If I switch to

    <dependency>
      <groupId>ai.hypergraph</groupId>
      <artifactId>kotlingrad-jvm</artifactId>
      <version>0.4.7</version>
    </dependency>

instead, I get failures to resolve kotlin-bom

Unresolved dependency: 'org.jetbrains.kotlin:kotlin-bom:jar:1.6.10'

Currently it seems impossible to use this project with the current pom setup. Do you have an example of an external project using kotlingrad where this works?

@breandan
Copy link
Owner

breandan commented May 6, 2022

Hi @snowe2010, thank you for checking out Kotlin∇! It should be possible to use Maven, however I have not rigorously tested this setup so there may be errors. Can you try cloning this project and run ./gradlew run on your local machine?

@snowe2010
Copy link
Author

snowe2010 commented May 10, 2022

Sure thing. After cloning that project and building (I set asdf to use a graalvm version of java17, but should still work the same) I get this error:

❯ asdf local java graalvm-22.0.0.2+java17

kotlingrad-consumer on  master via ☕ v17.0.2 via 🅺 v1.6.21 on ☁️  (us-west-2)
❯ ./gradlew run
Downloading https://services.gradle.org/distributions/gradle-7.4.2-bin.zip
...........10%...........20%...........30%...........40%...........50%...........60%...........70%...........80%...........90%...........100%

Welcome to Gradle 7.4.2!

Here are the highlights of this release:
 - Aggregated test and JaCoCo reports
 - Marking additional test source directories as tests in IntelliJ
 - Support for Adoptium JDKs in Java toolchains

For more details see https://docs.gradle.org/7.4.2/release-notes.html

Starting a Gradle Daemon (subsequent builds will be faster)

> Task :compileKotlin FAILED
e: /Users/tyler/Documents/dev/oss/kotlingrad-consumer/src/main/kotlin/Test.kt: (3, 10): Unresolved reference: DReal
e: /Users/tyler/Documents/dev/oss/kotlingrad-consumer/src/main/kotlin/Test.kt: (4, 10): Unresolved reference: DReal
e: /Users/tyler/Documents/dev/oss/kotlingrad-consumer/src/main/kotlin/Test.kt: (8, 17): Unresolved reference: sin
e: /Users/tyler/Documents/dev/oss/kotlingrad-consumer/src/main/kotlin/Test.kt: (9, 17): Unresolved reference: d
e: /Users/tyler/Documents/dev/oss/kotlingrad-consumer/src/main/kotlin/Test.kt: (9, 24): Unresolved reference: d
e: /Users/tyler/Documents/dev/oss/kotlingrad-consumer/src/main/kotlin/Test.kt: (10, 17): Unresolved reference: d
e: /Users/tyler/Documents/dev/oss/kotlingrad-consumer/src/main/kotlin/Test.kt: (10, 24): Unresolved reference: d
e: /Users/tyler/Documents/dev/oss/kotlingrad-consumer/src/main/kotlin/Test.kt: (11, 19): Unresolved reference: d
e: /Users/tyler/Documents/dev/oss/kotlingrad-consumer/src/main/kotlin/Test.kt: (11, 32): Unresolved reference: d
e: /Users/tyler/Documents/dev/oss/kotlingrad-consumer/src/main/kotlin/Test.kt: (12, 20): Unresolved reference: d
e: /Users/tyler/Documents/dev/oss/kotlingrad-consumer/src/main/kotlin/Test.kt: (12, 33): Unresolved reference: d
e: /Users/tyler/Documents/dev/oss/kotlingrad-consumer/src/main/kotlin/Test.kt: (18, 23): Unresolved reference: it
e: /Users/tyler/Documents/dev/oss/kotlingrad-consumer/src/main/kotlin/Test.kt: (25, 67): Unresolved reference: sin

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':compileKotlin'.
> A failure occurred while executing org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction
   > Compilation error. See log for more details

* 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

BUILD FAILED in 1m
1 actionable task: 1 executed

@snowe2010
Copy link
Author

Since it looks like you're trying to explicitly use java 15 I set asdf to use openjdk-15.0.2 which resulted in the same errors.

@snowe2010
Copy link
Author

Ok, seeing something really weird. I wipe your artifact from my .m2 repo and then the gradle build works fine.

❯ rm -rf ~/.m2/repository/ai/

kotlingrad-consumer on  master [?] via ☕ v15.0.2 via 🅺 v1.6.21 on ☁️  (us-west-2)
❯ ./gradlew run

> Task :run
z(x, y)         = ((x) prod ((sub(sin((x) prod (y)))) sum (y))) prod (4.0)
z(0, 1)         = 0.0
∂z/∂x           = d(((x) prod ((sub(sin((x) prod (y)))) sum (y))) prod (4.0)) / d(x)
                = 4.0
∂z/∂y           = d(((x) prod ((sub(sin((x) prod (y)))) sum (y))) prod (4.0)) / d(y)
                = 0.0
∂²z/∂x²         = d(((x) prod ((sub(sin((x) prod (y)))) sum (y))) prod (4.0)) / d(y)
                = -8.0
∂²z/∂x∂y        = d(d(((x) prod ((sub(sin((x) prod (y)))) sum (y))) prod (4.0)) / d(x)) / d(y)
                = -8.0
∇z              = {x=d(((x) prod ((sub(sin((x) prod (y)))) sum (y))) prod (4.0)) / d(x), y=d(((x) prod ((sub(sin((x) prod (y)))) sum (y))) prod (4.0)) / d(y)}
                = [4.0, 0.0]ᵀ
t(x, y)         = (((d(d(((((1.0) sum ((x) prod (2.0))) sum (-3.0)) sum (y)) sum ((((x) prod ((sub(sin((x) prod (y)))) sum (y))) prod (4.0)) prod ((y).pow(-1.0)))) / d(y)) / d(x)) sum (((((x) prod ((sub(sin((x) prod (y)))) sum (y))) prod (4.0)) prod ((y).pow(-1.0))) prod (3.0))) sum (-2.0)) sum (sin(x))

BUILD SUCCESSFUL in 1s
2 actionable tasks: 1 executed, 1 up-to-date

As soon as I try to build using maven it fails. I believe this might be related to our nexus repository. I'll get back to you in a bit.

@snowe2010
Copy link
Author

@breandan it looks like the issue is with the maven artifact, though not sure why. It fails even if I use the artifact from maven central, so it's not an issue with our nexus repo. Here is an example app:
kotlingrad-maven.zip

@snowe2010
Copy link
Author

from a cursory glance over the code it looks like you're not actually adding the jar to the publication, though I'm not sure how this is working with gradle then. I suspect it's due to gradle's metadata capabilities.

@breandan
Copy link
Owner

breandan commented May 12, 2022

You're probably right, it looks like something to do with how we're publishing our build artifact. I used to be a fan of Gradle, but after nearly a decade of fighting with it (e.g., #6, #26 in just this project) I've come to accept the fact that I do not understand Gradle and never will. Typically Gradle can resolve Maven dependencies written as:

dependencies { implementation("G:A:V") }

But the fact that Maven cannot resolve Gradle artifacts published on Maven Central using the syntax:

<dependency><groupId>G</groupId><artifactId>A</artifactId><version>V</version></dependency>

indicates to me that something is definitely wrong with (1) either our Maven publication or (2) Gradle's dependency resolution mechanism or (3) possibly both. Thank you for reporting this issue!

@snowe2010
Copy link
Author

Yes, Gradle can be quite difficult to use, though I do like it more than Maven for most use cases. Looking at your build.gradle though, it is quite complex, so I would expect some issues with that. I don't completely understand everything you're doing, especially with the git submodules and this shipshape library. I think most of the issues here are coming from your use of kotlin multiplatform. Have you tried following along with how a project like kotest does multiplatform?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants