mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-04-25 07:57:12 -07:00
Added "offline" argument to prevent remote resolving of dependencies
This commit is contained in:
parent
6c031cd3c1
commit
f1a025036f
3 changed files with 7 additions and 2 deletions
|
@ -61,6 +61,9 @@ class Args {
|
|||
@Parameter(names = arrayOf("--noIncremental"), description = "Turn off incremental builds")
|
||||
var noIncremental: Boolean = false
|
||||
|
||||
@Parameter(names = arrayOf("--offline"), description = "Don't try to download dependencies even if there is no cached version")
|
||||
var offline: Boolean = false
|
||||
|
||||
@Parameter(names = arrayOf("--plugins"), description = "Comma-separated list of plug-in Maven id's")
|
||||
var pluginIds: String? = null
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.beust.kobalt.maven.aether
|
|||
|
||||
import com.beust.kobalt.internal.KobaltSettings
|
||||
import com.google.common.eventbus.EventBus
|
||||
import com.beust.kobalt.Args
|
||||
import org.eclipse.aether.DefaultRepositorySystemSession
|
||||
import org.eclipse.aether.RepositorySystem
|
||||
import org.eclipse.aether.repository.LocalRepository
|
||||
|
@ -32,8 +33,9 @@ object Booter {
|
|||
// }
|
||||
|
||||
fun newRepositorySystemSession(system: RepositorySystem, repo: File, settings: KobaltSettings,
|
||||
eventBus: EventBus): DefaultRepositorySystemSession {
|
||||
args: Args, eventBus: EventBus): DefaultRepositorySystemSession {
|
||||
val session = MavenRepositorySystemUtils.newSession(settings)
|
||||
session.isOffline = args.offline
|
||||
|
||||
val localRepo = LocalRepository(repo.absolutePath)
|
||||
session.localRepositoryManager = system.newLocalRepositoryManager(session, localRepo)
|
||||
|
|
|
@ -141,7 +141,7 @@ class KobaltMavenResolver @Inject constructor(val settings: KobaltSettings,
|
|||
fun create(id: String, optional: Boolean) = AetherDependency(DefaultArtifact(id), optional, args)
|
||||
|
||||
private val system = Booter.newRepositorySystem()
|
||||
private val session = Booter.newRepositorySystemSession(system, localRepo.localRepo, settings, eventBus)
|
||||
private val session = Booter.newRepositorySystemSession(system, localRepo.localRepo, settings, args, eventBus)
|
||||
|
||||
private fun createRepo(hostConfig: HostConfig) : RemoteRepository {
|
||||
val builder = RemoteRepository.Builder(hostConfig.name, "default", hostConfig.url)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue