GithubHelp home page GithubHelp logo

Comments (4)

aartiPl avatar aartiPl commented on September 26, 2024

This seems to work in kscript 4.1.1:

@file:Repository("https://dl.google.com/android/maven2")
@file:DependsOn("com.google.firebase:firebase-analytics-ktx:aar:21.1.1"")

But a similar change for jitpack doesn't:

//@file:Repository("https://jitpack.io")
//@file:DependsOn("com.github.cookpad:puree-android:aar:5.1.0")

I will still have a look at the second case.

from kscript.

aartiPl avatar aartiPl commented on September 26, 2024

Ok. I think I got it. The jitpack fails not because of lack of "com.github.cookpad:puree-android:aar:5.1.0", but because of the lack of dependency for that library: "androidx.sqlite:sqlite-framework:jar:2.0.1"

The whole log in kscript goes as follows:

[kscript] Adding repository: Repository(id=, url=https://jitpack.io, user=, password=)
[kscript] Adding repository: Repository(id=, url=https://dl.google.com/android/maven2, user=, password=)
[kscript] [WARN] Configured repository: https___jitpack.io (https://jitpack.io, default, releases+snapshots)
[kscript] [WARN] Configured repository: https___dl.google.com_android_maven2 (https://dl.google.com/android/maven2, default, releases+snapshots)
[kscript] [WARN] Configured repository: https___repo.maven.apache.org_maven2 (https://repo.maven.apache.org/maven2, default, releases+snapshots)
[kscript] Resolving com.github.cookpad:puree-android:aar:5.1.0...
[kscript] Resolving com.google.firebase:firebase-analytics-ktx:aar:21.1.1...
[kscript] [WARN] Resolution result: Failure(reports=[WARNING File 'com.github.cookpad:puree-android:aar:5.1.0' not found, WARNING org.jetbrains.kotlin.org.eclipse.aether.resolution.DependencyResolutionException: Could not find artifact androidx.sqlite:sqlite-framework:jar:2.0.1 in https___jitpack.io (https://jitpack.io)])
[kscript] [ERROR] Failed while connecting to the server. Check the connection (http/https, port, proxy, credentials, etc.)of your maven dependency locators. If you suspect this is a bug, you can create an issue on https://github.com/holgerbrandl/kscript
[kscript] [ERROR] File 'com.github.cookpad:puree-android:aar:5.1.0' not found
[kscript] [ERROR] org.jetbrains.kotlin.org.eclipse.aether.resolution.DependencyResolutionException: Could not find artifact androidx.sqlite:sqlite-framework:jar:2.0.1 in https___jitpack.io (https://jitpack.io)

The message from resolver is correct - there is no such artifact "androidx.sqlite:sqlite-framework:jar:2.0.1", but there is another one: "androidx.sqlite:sqlite-framework :aar: 2.0.1". Please notice the type of the artifact - the correct one is of type aar.

Artifact resolution is done in Kotlin scripting artifact resolver. It looks for me that it assumes that resolved artifacts will always have 'jar' extension.

This is part of the pom file for "com.github.cookpad:puree-android:aar:5.1.0"

<dependencies>
  <dependency>
    <groupId>androidx.sqlite</groupId>
    <artifactId>sqlite-framework</artifactId>
    <version>2.0.1</version>
    <scope>compile</scope>
   </dependency>
</dependencies>

As you can see above there is no definition of type of sqlite-framework, so seems that Kotlin scripting dependency resolver assumes it is ".jar", but in this case it is ".aar".

So in my opinion it is something to be fixed in Kotlin scripting dependency resolver. Probably the rule here is that if initial file is of type 'aar', then also for resolved dependencies there should be assumption that dependency is also 'aar'. Or maybe if it is not defined both types should be checked.

Please have a look at my analysis: @ligee, @ileasile . Can you please raise the ticket if my analysis is correct?

from kscript.

ileasile avatar ileasile commented on September 26, 2024

Hello @aartiPl! Thank you for your analysis. It seems that you're correct, Maven resolver takes jar as a type if another type isn't stated in the dependency. Workaround is to write DependsOn annotation for each transitive dependency manually.
There is also an option in the latest versions of Kotlin that allows to skip unsuccessfully resolved dependencies, it may also help. You're interested in transitive and partial_resolution options here: https://github.com/JetBrains/kotlin/blob/af8b9e6700f25ed2fba40965accaf7d47f3dfda9/libraries/scripting/dependencies/src/kotlin/script/experimental/dependencies/impl/resolverNamedOptions.kt#L24

I'll filed an issue in the Kotlin project about it: https://youtrack.jetbrains.com/issue/KT-54757/Cant-resolve-dependency-with-non-jar-extension-if-it-has-dependencies-with-non-jar-extensions

from kscript.

aartiPl avatar aartiPl commented on September 26, 2024

Closing as it is an upstream issue.

from kscript.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.