1
0
Fork 0
mirror of https://github.com/ethauvin/kobalt.git synced 2025-04-27 00:38:11 -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.HostConfig
import com.beust.kobalt.api.Kobalt import com.beust.kobalt.api.Kobalt
import com.beust.kobalt.maven.dependency.FileDependency
import com.beust.kobalt.misc.KobaltExecutors import com.beust.kobalt.misc.KobaltExecutors
import com.beust.kobalt.misc.Strings import com.beust.kobalt.misc.Strings
import com.beust.kobalt.misc.log import com.beust.kobalt.misc.log
@ -78,7 +79,8 @@ public class RepoFinder @Inject constructor(val executors: KobaltExecutors) {
if (! mavenId.hasVersion) { if (! mavenId.hasVersion) {
val ud = UnversionedDep(groupId, artifactId) 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) { if (foundVersion != null) {
return RepoResult(repo, true, foundVersion) return RepoResult(repo, true, foundVersion)
} else { } else {
@ -88,7 +90,8 @@ public class RepoFinder @Inject constructor(val executors: KobaltExecutors) {
val version = mavenId.version val version = mavenId.version
if (version!!.contains("SNAPSHOT")) { if (version!!.contains("SNAPSHOT")) {
val dep = SimpleDep(mavenId) 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) { if (snapshotVersion != null) {
return RepoResult(repo, true, version, true /* hasJar, potential bug here */, return RepoResult(repo, true, version, true /* hasJar, potential bug here */,
snapshotVersion) snapshotVersion)

View file

@ -11,10 +11,6 @@ open public class SimpleDep(open val mavenId: MavenId) : UnversionedDep(mavenId.
val version: String get() = mavenId.version!! 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 { private fun toFile(v: String, s: String, suffix: String) : String {
val fv = if (v.contains("SNAPSHOT")) v.replace("SNAPSHOT", "") else v val fv = if (v.contains("SNAPSHOT")) v.replace("SNAPSHOT", "") else v
val result = Strings.join("/", arrayListOf(toDirectory(v, false) + 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. * eventually resolve to the latest version of the artifact.
*/ */
open public class UnversionedDep(open val groupId: String, open val artifactId: String) { open public class UnversionedDep(open val groupId: String, open val artifactId: String) {
open public fun toMetadataXmlPath(fileSystem: Boolean = true): String { open public fun toMetadataXmlPath(fileSystem: Boolean = true, isLocal: Boolean): String {
return toDirectory("", fileSystem) + "maven-metadata.xml" return toDirectory("", fileSystem) + if (isLocal) "maven-metadata-local.xml" else "maven-metadata.xml"
} }
/** /**