mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-04-26 08:27:12 -07:00
Fix maven-metadata-local.xml.
This commit is contained in:
parent
5468a380f2
commit
872a0d3961
2 changed files with 16 additions and 3 deletions
|
@ -91,7 +91,8 @@ public class RepoFinder @Inject constructor(val executors: KobaltExecutors) {
|
|||
if (version!!.contains("SNAPSHOT")) {
|
||||
val dep = SimpleDep(mavenId)
|
||||
val isLocal = repoUrl.startsWith(FileDependency.PREFIX_FILE)
|
||||
val snapshotVersion = findSnapshotVersion(dep.toMetadataXmlPath(false, isLocal), repoUrl)
|
||||
val snapshotVersion = if (isLocal) version!!
|
||||
else findSnapshotVersion(dep.toMetadataXmlPath(false, isLocal, version), repoUrl)
|
||||
if (snapshotVersion != null) {
|
||||
return RepoResult(repo, true, version, true /* hasJar, potential bug here */,
|
||||
snapshotVersion)
|
||||
|
@ -154,6 +155,12 @@ public class RepoFinder @Inject constructor(val executors: KobaltExecutors) {
|
|||
val bn = buildNumber.evaluate(doc, XPathConstants.STRING)
|
||||
if (! Strings.isEmpty(ts.toString()) && ! Strings.isEmpty(bn.toString())) {
|
||||
return ts.toString() + "-" + bn.toString()
|
||||
} else {
|
||||
val lastUpdated = XPATH.compile("/metadata/versioning/lastUpdated")
|
||||
if (! lastUpdated.toString().isEmpty()) {
|
||||
return lastUpdated.toString()
|
||||
}
|
||||
|
||||
}
|
||||
} catch(ex: Exception) {
|
||||
log(2, "Couldn't find metadata at $url")
|
||||
|
|
|
@ -8,8 +8,14 @@ import java.io.File
|
|||
* eventually resolve to the latest version of the artifact.
|
||||
*/
|
||||
open class UnversionedDep(open val groupId: String, open val artifactId: String) {
|
||||
open fun toMetadataXmlPath(fileSystem: Boolean = true, isLocal: Boolean) =
|
||||
toDirectory("", fileSystem) + if (isLocal) "maven-metadata-local.xml" else "maven-metadata.xml"
|
||||
open fun toMetadataXmlPath(fileSystem: Boolean = true, isLocal: Boolean, version: String? = null) : String {
|
||||
var result = toDirectory("", fileSystem) + if (isLocal) "maven-metadata-local.xml" else "maven-metadata.xml"
|
||||
if (! File(result).exists() && version != null) {
|
||||
result = toDirectory("", fileSystem) + version + File.separator +
|
||||
if (isLocal) "maven-metadata-local.xml" else "maven-metadata.xml"
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
/**
|
||||
* Turn this dependency to a directory. If fileSystem is true, use the file system
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue