As soon as one defines a custom repository, an imp...
# scripting
p
As soon as one defines a custom repository, an implicit dependency on Maven Central is gone and needs to be added explicitly. I'm thinking about adding constants to Kotlin scripting definition that would contain URLs to Maven Central and Maven local while touching this topic, to have:
Copy code
// now
@file:Repository("<https://repo1.maven.org/maven2/>")

// proposed
@file:Repository(MAVEN_CENTRAL) or @file:Repository(mavenCentral()) for parity with Gradle
and
Copy code
// now
@file:Repository("file://~/.m2/repository/")

// proposed
@file:Repository(MAVEN_LOCAL) or @file:Repository(mavenLocal()) for parity with Gradle
thoughts?
👍 1
any thoughts on the preferred API?1️⃣
MAVEN_CENTRAL
is a convention used for constants • 2️⃣
mavenCentral()
is used in Gradle
1️⃣ 2
2️⃣ 1
a
isn't option 2 impossible? Annotation args have to be compile-time constants
p
ah, true! yeah, so we're left with 1️⃣ , I wouldn't like to propose any hacks to allow the second syntax
j
I would even add constants for all known repositories: • Google • androidx • Gradle portal • Snapshots • JetBrains dev
💡 1
Pretty annoying when I have to find some of then from one repository just to copy paste
p
Gradle plugin portal repo is probably not needed in the context of Kotlin scripting, but for the rest, I totally agree
n
also the path to mavenLocal
file://~/.m2/repository
?
p
proposed in the original message
👍 1
a
Maven Local can be set with a system property - https://stackoverflow.com/a/57223696/4161471. So perhaps a specific
@file:MavenLocal
annotation is needed that will use
maven.repo.local
or default to
~/.m2/repository
👍 1
p
created a YouTrack ticket to track it: https://youtrack.jetbrains.com/issue/KT-67861