diff --git a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/Args.kt b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/Args.kt index d1cdc078..372f1ba1 100644 --- a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/Args.kt +++ b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/Args.kt @@ -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 diff --git a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/maven/aether/Booter.kt b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/maven/aether/Booter.kt index e3b52dcd..02917929 100644 --- a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/maven/aether/Booter.kt +++ b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/maven/aether/Booter.kt @@ -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) diff --git a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/maven/aether/KobaltMavenResolver.kt b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/maven/aether/KobaltMavenResolver.kt index 06a7c993..f5fcde59 100644 --- a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/maven/aether/KobaltMavenResolver.kt +++ b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/maven/aether/KobaltMavenResolver.kt @@ -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)