1
0
Fork 0
mirror of https://github.com/ethauvin/kobalt.git synced 2025-04-26 08:27:12 -07:00

Local metadata is called maven-metadata-local.xml.

This commit is contained in:
Cedric Beust 2015-12-12 01:06:18 +04:00
parent f37965500c
commit 9d4d9dce5f
3 changed files with 7 additions and 8 deletions

View file

@ -2,6 +2,7 @@ package com.beust.kobalt.maven
import com.beust.kobalt.HostConfig
import com.beust.kobalt.api.Kobalt
import com.beust.kobalt.maven.dependency.FileDependency
import com.beust.kobalt.misc.KobaltExecutors
import com.beust.kobalt.misc.Strings
import com.beust.kobalt.misc.log
@ -78,7 +79,8 @@ public class RepoFinder @Inject constructor(val executors: KobaltExecutors) {
if (! mavenId.hasVersion) {
val ud = UnversionedDep(groupId, artifactId)
val foundVersion = findCorrectVersionRelease(ud.toMetadataXmlPath(false), repoUrl)
val isLocal = repoUrl.startsWith(FileDependency.PREFIX_FILE)
val foundVersion = findCorrectVersionRelease(ud.toMetadataXmlPath(false, isLocal), repoUrl)
if (foundVersion != null) {
return RepoResult(repo, true, foundVersion)
} else {
@ -88,7 +90,8 @@ public class RepoFinder @Inject constructor(val executors: KobaltExecutors) {
val version = mavenId.version
if (version!!.contains("SNAPSHOT")) {
val dep = SimpleDep(mavenId)
val snapshotVersion = findSnapshotVersion(dep.toMetadataXmlPath(false), repoUrl)
val isLocal = repoUrl.startsWith(FileDependency.PREFIX_FILE)
val snapshotVersion = findSnapshotVersion(dep.toMetadataXmlPath(false, isLocal), repoUrl)
if (snapshotVersion != null) {
return RepoResult(repo, true, version, true /* hasJar, potential bug here */,
snapshotVersion)

View file

@ -11,10 +11,6 @@ open public class SimpleDep(open val mavenId: MavenId) : UnversionedDep(mavenId.
val version: String get() = mavenId.version!!
override public fun toMetadataXmlPath(fileSystem: Boolean): String {
return toDirectory(version, fileSystem) + "maven-metadata.xml"
}
private fun toFile(v: String, s: String, suffix: String) : String {
val fv = if (v.contains("SNAPSHOT")) v.replace("SNAPSHOT", "") else v
val result = Strings.join("/", arrayListOf(toDirectory(v, false) +

View file

@ -8,8 +8,8 @@ import java.io.File
* eventually resolve to the latest version of the artifact.
*/
open public class UnversionedDep(open val groupId: String, open val artifactId: String) {
open public fun toMetadataXmlPath(fileSystem: Boolean = true): String {
return toDirectory("", fileSystem) + "maven-metadata.xml"
open public fun toMetadataXmlPath(fileSystem: Boolean = true, isLocal: Boolean): String {
return toDirectory("", fileSystem) + if (isLocal) "maven-metadata-local.xml" else "maven-metadata.xml"
}
/**