Skip to content

Commit

Permalink
Make maven repository optional again
Browse files Browse the repository at this point in the history
  • Loading branch information
fwcd committed Jul 28, 2024
1 parent b490bce commit bb7b8f0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
5 changes: 1 addition & 4 deletions shared/src/main/kotlin/org/javacs/kt/classpath/Home.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,10 @@ private fun readMavenDependencyListWithSources(artifacts: Set<Artifact>, 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
Expand Down

0 comments on commit bb7b8f0

Please sign in to comment.