diff --git a/shared/src/main/kotlin/org/javacs/kt/classpath/Home.kt b/shared/src/main/kotlin/org/javacs/kt/classpath/Home.kt index 462e86111..b8c236e9b 100644 --- a/shared/src/main/kotlin/org/javacs/kt/classpath/Home.kt +++ b/shared/src/main/kotlin/org/javacs/kt/classpath/Home.kt @@ -17,10 +17,7 @@ private val possibleMavenRepositoryPaths = ) .filterNotNull() -internal val mavenRepository = +internal val mavenRepository: Path? = possibleMavenRepositoryPaths.firstOrNull { Files.exists(it) } - ?: throw KotlinLSException( - "No repositories found at \$MAVEN_REPOSITORY, \$MAVEN_HOME, \$M2_HOME or \$HOME/.m2" - ) internal val gradleHome = createPathOrNull("GRADLE_USER_HOME") ?: userHome.resolve(".gradle") diff --git a/shared/src/main/kotlin/org/javacs/kt/classpath/MavenClassPathResolver.kt b/shared/src/main/kotlin/org/javacs/kt/classpath/MavenClassPathResolver.kt index a984252ab..a34bbccb1 100644 --- a/shared/src/main/kotlin/org/javacs/kt/classpath/MavenClassPathResolver.kt +++ b/shared/src/main/kotlin/org/javacs/kt/classpath/MavenClassPathResolver.kt @@ -88,10 +88,10 @@ private fun readMavenDependencyListWithSources(artifacts: Set, sources private fun findMavenArtifact(a: Artifact, source: Boolean): Path? { val result = mavenRepository - .resolve(a.group.replace('.', File.separatorChar)) - .resolve(a.artifact) - .resolve(a.version) - .resolve(mavenJarName(a, source)) + ?.resolve(a.group.replace('.', File.separatorChar)) + ?.resolve(a.artifact) + ?.resolve(a.version) + ?.resolve(mavenJarName(a, source)) return if (Files.exists(result)) result