mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-04-26 16:28:12 -07:00
Fix: the sources don’t get downloaded if the jar file is present.
This commit is contained in:
parent
ebedb8546a
commit
bfa2fb072e
1 changed files with 3 additions and 11 deletions
|
@ -4,9 +4,6 @@ import com.beust.kobalt.api.Dependencies
|
||||||
import com.beust.kobalt.api.IClasspathDependency
|
import com.beust.kobalt.api.IClasspathDependency
|
||||||
import com.beust.kobalt.api.Kobalt
|
import com.beust.kobalt.api.Kobalt
|
||||||
import com.beust.kobalt.maven.CompletedFuture
|
import com.beust.kobalt.maven.CompletedFuture
|
||||||
import com.beust.kobalt.maven.LocalDep
|
|
||||||
import com.beust.kobalt.maven.LocalRepo
|
|
||||||
import com.beust.kobalt.maven.MavenId
|
|
||||||
import com.beust.kobalt.misc.StringVersion
|
import com.beust.kobalt.misc.StringVersion
|
||||||
import com.beust.kobalt.misc.warn
|
import com.beust.kobalt.misc.warn
|
||||||
import org.eclipse.aether.artifact.Artifact
|
import org.eclipse.aether.artifact.Artifact
|
||||||
|
@ -26,18 +23,13 @@ class AetherDependency(val artifact: Artifact, override val optional: Boolean =
|
||||||
private fun toId(a: Artifact) = a.toString()
|
private fun toId(a: Artifact) = a.toString()
|
||||||
|
|
||||||
override val jarFile: Future<File>
|
override val jarFile: Future<File>
|
||||||
get() = if (artifact.file != null) {
|
get() =
|
||||||
|
if (artifact.file != null) {
|
||||||
CompletedFuture(artifact.file)
|
CompletedFuture(artifact.file)
|
||||||
} else {
|
|
||||||
val localRepo = Kobalt.INJECTOR.getInstance(LocalRepo::class.java)
|
|
||||||
val file = File(LocalDep(MavenId.create(id), localRepo).toAbsoluteJarFilePath(version))
|
|
||||||
if (file.exists()) {
|
|
||||||
CompletedFuture(file)
|
|
||||||
} else {
|
} else {
|
||||||
val td = aether.resolve(artifact, null)
|
val td = aether.resolve(artifact, null)
|
||||||
CompletedFuture(td.root.artifact.file)
|
CompletedFuture(td.root.artifact.file)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
override fun toMavenDependencies(scope: String?) : org.apache.maven.model.Dependency {
|
override fun toMavenDependencies(scope: String?) : org.apache.maven.model.Dependency {
|
||||||
val passedScope = scope
|
val passedScope = scope
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue