Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make maven repository optional again #584

Merged
merged 1 commit into from
Jul 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading