diff --git a/docs/config.md b/docs/config.md index f271f38a2d..954bb43a28 100644 --- a/docs/config.md +++ b/docs/config.md @@ -1648,10 +1648,13 @@ The following environment variables control the configuration of the Nextflow ru : Allows the setting Java VM options. This is similar to `NXF_OPTS` however it's only applied the JVM running Nextflow and not to any java pre-launching commands. `NXF_OFFLINE` -: When `true` disables the project automatic download and update from remote repositories (default: `false`). +: When `true` prevents Nextflow from automatically downloading and updating remote project repositories (default: `false`). : :::{versionchanged} 23.09.0-edge This option also disables the automatic version check (see `NXF_DISABLE_CHECK_LATEST`). ::: +: :::{versionchanged} 23.11.0-edge + This option also prevents plugins from being downloaded. Plugin versions must be specified in offline mode, or else Nextflow will fail. + ::: `NXF_OPTS` : Provides extra options for the Java and Nextflow runtime. It must be a blank separated list of `-Dkey[=value]` properties. diff --git a/modules/nf-commons/src/main/nextflow/plugin/PluginUpdater.groovy b/modules/nf-commons/src/main/nextflow/plugin/PluginUpdater.groovy index 4e773877af..98a5739273 100644 --- a/modules/nf-commons/src/main/nextflow/plugin/PluginUpdater.groovy +++ b/modules/nf-commons/src/main/nextflow/plugin/PluginUpdater.groovy @@ -224,7 +224,7 @@ class PluginUpdater extends UpdateManager { safeMove(dir, pluginPath) } catch (IOException e) { - throw new PluginRuntimeException(e, "Failed to write file '$pluginPath' to plugins folder"); + throw new PluginRuntimeException(e, "Failed to write file '$pluginPath' to plugins folder") } return pluginPath @@ -318,8 +318,14 @@ class PluginUpdater extends UpdateManager { if( version == null ) version = getLastPluginRelease(id)?.version - if( !version ) - throw new IllegalStateException("Cannot find latest version of $id plugin") + + final offline = SysEnv.get('NXF_OFFLINE')=='true' + if( !version ) { + final msg = offline + ? "Cannot find version for $id plugin -- plugin versions MUST be specified in offline mode" + : "Cannot find latest version of $id plugin" + throw new IllegalStateException(msg) + } def pluginPath = pluginsStore.resolve("$id-$version") if( !FilesEx.exists(pluginPath) ) { @@ -363,7 +369,7 @@ class PluginUpdater extends UpdateManager { // resolve the plugins pluginManager.resolvePlugins() // finally start it - PluginState state = pluginManager.startPlugin(id); + PluginState state = pluginManager.startPlugin(id) return PluginState.STARTED == state } @@ -381,13 +387,13 @@ class PluginUpdater extends UpdateManager { throw new PluginRuntimeException("Plugin $id cannot be updated since it is not installed") } - PluginInfo pluginInfo = getPluginsMap().get(id); + PluginInfo pluginInfo = getPluginsMap().get(id) if (pluginInfo == null) { throw new PluginRuntimeException("Plugin $id does not exist in any repository") } if (!pluginManager.deletePlugin(id)) { - return false; + return false } load0(id, version) diff --git a/modules/nf-commons/src/main/nextflow/plugin/PluginsFacade.groovy b/modules/nf-commons/src/main/nextflow/plugin/PluginsFacade.groovy index 5af5b2d2a6..b4320d435e 100644 --- a/modules/nf-commons/src/main/nextflow/plugin/PluginsFacade.groovy +++ b/modules/nf-commons/src/main/nextflow/plugin/PluginsFacade.groovy @@ -55,7 +55,7 @@ class PluginsFacade implements PluginStateListener { PluginsFacade() { mode = getPluginsMode() root = getPluginsDir() - if( mode=='dev' && root.toString()=='plugins' && !isRunningFromDistArchive() ) + if( mode==DEV_MODE && root.toString()=='plugins' && !isRunningFromDistArchive() ) root = detectPluginsDevRoot() System.setProperty('pf4j.mode', mode) }