Comments (4)
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.
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.
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.
Closing as it is an upstream issue.
from kscript.
Related Issues (20)
- Create kscript package for scoop HOT 7
- Don't work @file:Import("absolute/path/to/myutils.kt") HOT 2
- Basic hello world example does not work with interpreter HOT 1
- Allow setting an alternate kotlinc binary (or use kotlinc-jvm)
- Add an option to suppress final error output HOT 10
- [Windows] path to kotlinc not quoted HOT 4
- How to load text file via relative path? HOT 2
- kscript --interactive does not resolve the variables defined inside .kts file HOT 1
- kscript environment variable substitution for repositories no longer works HOT 6
- Does not work with Kotlin 1.9.0 HOT 12
- Can kscript used in Android project written in kotlin HOT 1
- Can you change kscript's included java version? HOT 1
- [question] daemon concept HOT 4
- Does not support spaces in KOTLIN_HOME variable.
- --package is broken in 4.2.3 - doesn't include stuff in local dependencies
- Fresh checkout of repo causes failure on `gradle run` and other ways of invoking `kscript` fail for the same reason
- kscript downloading Kotlin Native jars during dependency resolution - why? HOT 1
- Example in README with @file:Import fails
- Use version 4.2.3 on Dockerfile
- Does not work with Kotlin 2.0.0 HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from kscript.