Ousc
09/30/2024, 9:47 AMkotlin.test
dependency in my local maven repository seems to get lost when I switch between projects (some of them use maven
builds, some use gradle
builds).
the project prompts that kotlin.test
is not found, and refresh gradle dependencies doesn't fix it, the only way I can fix it is by deleting the ~/.m2/org/jetbrains /kotlin/kotlin-test
folder and reloading the gradle project to fix it.
Both my partner and I are experiencing the same issue when running a few specific projects.
Has anyone else encountered this or have any ideas on how to resolve it, it's been bugging me for a long time 😞.CLOVIS
09/30/2024, 6:30 PM~/.m2
at all by default. Dependencies downloaded by Gradle are stored in ~/.gradle/caches
.
Can you check if you use something that looks like this anywhere in your projects?
repositories {
mavenLocal()
}
Then, remove the mavenLocal()
call (keep other repositories). If you had a good reason to have those, it will break elsewhere, but I can't help without knowing why it was done this way.Ousc
10/01/2024, 12:49 AMCLOVIS
10/01/2024, 7:34 AMincludeBuild
to link to another Gradle build that isn't published. Depending on what you want to include, it's slightly different. To include another plugin, use something like this with the path of the plugin: https://gitlab.com/opensavvy/automation/gradle-conventions/-/blob/main/settings.gradle.kts?ref_type=heads#L18-L21
You need no other configuration, and as a bonus, it is also recognized by IntelliJ, meaning you will be able to navigate into the plugin etc just like if it was part of the current projet. You don't need to have a specific version of the plugin etc, it will automatically use the version that's available at that path.Ousc
10/01/2024, 1:51 PMsetting.gradle.kts
before I changed it: https://github.com/Kronos-orm/Kronos-orm/blob/main/settings.gradle.kts
I tried deleting mavenLocal()
in setting.gradle.kts
and adding includeBuild("./kronos-gradle-plugin")
, but it seems that the gradle build cannot run after doing this.
I know that there is something wrong with my organization of gradle projects, but this is really too difficult for me.
Actually, all I want to do is enable a gradle plugin subproject(kronos-gradle-plugin
) in another subproject (kronos-testing
) in the root project. I know that publishing to mavenLocal is not a good choice, but I really haven't found a better way.
Can includeBuild
be used for this scenario, or are there other improvements I should make?CLOVIS
10/01/2024, 6:46 PMbut it seems that the gradle build cannot run after doing this.I can't help you without an error message
CLOVIS
10/01/2024, 6:49 PMkronos-gradle-plugin
is in the same build: that folder doesn't have a settings.gradle.kts
. Plugins cannot be used in the same build as they are declared in. You should have a separate settings.gradle.kts
file in kronos-gradle-plugin
, then it will work. You can keep it very simple.
So,
1. Create kronos-gradle-plugin/settings.gradle.kts
with the contents:
rootProject.name = "kronos-gradle-plugin"
dependencyResolutionManagement {
repositories {
mavenCentral()
}
}
2. Remove include("kronos-gradle-plugin")
from your root settings.gradle.kts
3. Include the plugin in your root settings.gradle.kts
:
pluginManagement {
includeBuild("./kronos-gradle-plugin")
}
Ousc
10/01/2024, 11:21 PMCLOVIS
10/02/2024, 7:22 AMOusc
10/02/2024, 9:47 PM<http://com.vanniktech.maven.publish.xxx|com.vanniktech.maven.publish.xxx>
cannot be found
2. api(project(xxx))
is no longer effective
3. And the public functions in the outermost buildSrc cannot be read
Is there any good solution? Do I need to add some settingsCLOVIS
10/03/2024, 1:32 PM@clovis-ai
) ? It's quite a large thing, it's hard to answer via slackOusc
10/03/2024, 2:02 PMCan you create a github issue/pr that describes the problem and ping me there (Ok, I'll build a minimal repro as soon as possible) ? It's quite a large thing, it's hard to answer via slack@clovis-ai
CLOVIS
10/03/2024, 2:02 PMCLOVIS
10/03/2024, 2:03 PMOusc
10/04/2024, 3:53 PM