I'm encountering a syncing issue with Gradle
while trying to set up a project with Kotlin
and Compose Desktop
.
Here's my build.gradle.kts
file:
import org.jetbrains.compose.desktop.application.dsl.TargetFormat
plugins {
kotlin("jvm")
id("org.jetbrains.compose")
}
group = "io.crypto"
version = "1.0-SNAPSHOT"
repositories {
mavenCentral()
maven("https://maven.pkg.jetbrains.space/public/p/compose/dev")
}
dependencies {
implementation(compose.desktop.currentOs)
}
compose.desktop {
application {
mainClass = "MainKt"
nativeDistributions {
targetFormats(TargetFormat.Dmg, TargetFormat.Msi, TargetFormat.Deb)
packageName = "CryptoGraph"
packageVersion = "1.0.0"
}
}
}
and here is setting.gradle.kts
file:
pluginManagement {
repositories {
google()
gradlePluginPortal()
maven("https://maven.pkg.jetbrains.space/public/p/compose/dev")
}
plugins {
kotlin("jvm").version(extra["kotlin.version"] as String)
id("org.jetbrains.compose").version(extra["compose.version"] as String)
}
}
rootProject.name = "CryptoGraph"
here is my gradle.properties
file:
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
kotlin.code.style=official
kotlin.version=1.9.20
compose.version=1.5.10
here is my gradle-wrapper.properties
file:
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
and here is the error I'm facing:
Build file '/home/mbunderline76/tick-viewer/CryptoGraph/build.gradle.kts' line: 3
Plugin [id: 'org.jetbrains.kotlin.jvm', version: '1.9.20'] was not found in any of the following sources:
* Try:
> 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.
* Exception is:
org.gradle.api.plugins.UnknownPluginException: Plugin [id: 'org.jetbrains.kotlin.jvm', version: '1.9.20'] was not found in any of the following sources:
- Gradle Core Plugins (plugin is not in 'org.gradle' namespace)
- Plugin Repositories (could not resolve plugin artifact 'org.jetbrains.kotlin.jvm:org.jetbrains.kotlin.jvm.gradle.plugin:1.9.20')
Searched in the following repositories:
Google
Gradle Central Plugin Repository
maven(https://maven.pkg.jetbrains.space/public/p/compose/dev)<83 internal lines>
I use Intellij Idea Ultimate 2023.3.2
here is my gradle --version--
command output:
------------------------------------------------------------
Gradle 7.2
------------------------------------------------------------
Build time: 2021-08-17 09:59:03 UTC
Revision: a773786b58bb28710e3dc96c4d1a7063628952ad
Kotlin: 1.5.21
Groovy: 3.0.8
Ant: Apache Ant(TM) version 1.10.9 compiled on September 27 2020
JVM: 16.0.1 (Private Build 16.0.1+9-Ubuntu-120.04)
OS: Linux 6.2.0-39-generic amd64
What could be causing this problem, and how can I resolve it?
After extensive troubleshooting, I managed to identify the root cause of the issue. The problem lay within the .gradle/gradle.properties file. I had proxy settings configured there, which interfered with the Gradle plugin resolution process.
To resolve this issue:
.gradle/gradle.properties
file in a text editor.After making these changes, I was able to successfully sync my Gradle project and resolve the plugin resolution error.
I hope this solution helps others facing a similar issue.