Repository navigation
SOLR-17697 Use picocli instead of commons-cli - #3254
Conversation
|
Actually, I'd like to try to implement PoC for few initial tools. upd: oh, I didnt notice there is a PR created for this |
Yea, there's an in-progress exploration taking place, feel free to join the discussion about it or POC for yourself on how to solve various issues that arise. We're still trying to land on the most elegant way to introduce things, and I plan to dial down the ambitions for the other PR to do bare minimal for one or two tools, and perhaps the "start" tool. Eventually, when we start getting the grip on how things should flow, it will be easier to jump in and implement PRs for new tools, targeting this branch. |
4ddb026 to
97a673e
Compare
97a673e to
cb41a69
Compare
…n changes - SolrCLI --version now prints 'Client version:' matching commons-cli output - ZkConnectionOptions, ConnectionOptions (create/delete) and StatusTool gain -s/--solr-connection accepting a ZooKeeper or HTTP(s) connection string, with --solr-url now long-only, mirroring CommonCLIOptions on main - StatusTool picocli target options grouped mutually exclusive like the commons-cli OptionGroup; zk/connection targets resolved to a Solr URL via new shared CLIUtils.solrUrlFromConnection (extracted from normalizeSolrUrl) - CliDefaultValueProvider supports SOLR_CONNECTION env default - test_status.bats accepts both engines' mutual-exclusion error messages Connection parsing is string-only; network calls happen only at tool execution time, never during picocli parsing.
|
This branch is now up to date with latest What it took, beyond routine conflict resolution:
The zk→live-node URL resolution needed by StatusTool was extracted into |
Import IOException in ConnectionOptions and picocli.CommandLine in SolrCLITest instead of using fully qualified names.
The picocli field refactor made the credential-taking overload read the (unset) field instead of its parameter, so AssertTool's status checks sent no Authorization header and test_basic_auth.bats failed with 401.
…ages Project.javaexec was removed in Gradle 9 (which arrived with the main merge); use injected ExecOperations as done in gradle/globals.gradle. Regenerated pages/cli to reflect the new -s/--solr-connection option group on status, create, delete and zk subcommands.
# Conflicts: # solr/core/src/java/org/apache/solr/cli/AuthTool.java
Resolved conflicts in gradle/libs.versions.toml (kept picocli, took main's prometheus-metrics 1.8.0) and in gradle.lockfiles (took main's, then regenerated with resolveAndLockAll to re-add picocli entries). Ran updateLicenses, which removed stale bcprov/bcutil 1.81.1 sha1 files.
|
Please check out #4909 which sits on top of this one. That PR intends to prepare this branch for merge to As you'll see of that PR description, it is all back compat, users wont notice it is there, and the ref guide changes are moved into its own page with all the new generated man pages as children, so even the ref guide is opt-in for those interested. |
|
Merged in the other PR, and now this should be ready for inclusion in main, since picocli code is now fully opt-in and the docs are separate, add-only, not edit. @sigram I't's up to you whether it can also land on branch_10x for 10.1. I'm happy to let it sit on main for a while and then merge to 10x after the 10.1 release. |
|
@epugh, @jaykay12 The plan now is to
|
Conflicts resolved: - DeleteTool: adopt main's SOLR-18321 rewrite (collection status + configset V2 APIs via a plain SolrClient, --force now a deprecated no-op) and rewire the picocli path onto it, dropping the old ZooKeeper cluster-state scan. - Regenerated all gradle lockfiles to restore the cliDocsRuntime configuration alongside main's dependency updates.
Correct the stale "--delete-config ... default is true" wording: SOLR-17495 made config deletion opt-in but never updated the description. Keep the now-no-op --force documented, so existing scripts find out it has no effect. Regenerate the CLI ref-guide page.
…path The CreateParams refactor resolved the Solr URL only when a connection flag was passed on the command line, so SOLR_CONNECTION / ZK_HOST coming from the environment no longer reached createCore's existence check or the _default configset warning; both silently fell back to the default localhost URL. Since safeCheckCoreExists swallows connection errors, the "core already exists" guard was skipped rather than reported. Pass the fully resolved URL and track separately whether a connection option was actually given, which is what createCollection needs to decide between an explicit target and a live node.
Adds picocli alongside the existing commons-cli parser. Picocli is opt-in and off by default: set SOLR_PICOCLI=true Commands ported to picocli in this change: start, stop, status, version, auth, create, delete zk: cp, ls, mv, rm, mkroot, upconfig, downconfig, updateacls Remaining commands still run on commons-cli and are tracked in follow-up issues. Per-command ref guide pages are now generated from the picocli annotations. Co-authored-by: Eric Pugh <epugh@opensourceconnections.com> (cherry picked from commit b6b2b8f)
https://issues.apache.org/jira/browse/SOLR-17697
This PR is just a way to visualize the status of the feature branch
jira/SOLR-17697-picocli.Create PRs targeting that branch to tackle individual tasks, and then squash merge into this feature branch once done. Then at the end this branch can be merged (not-squash) into main to preserve each tool porting.
Pick a tool not yet converted from the list below. You'll find a useful LLM prompt template in the JIRA issue linked above. Feel free to link your PR number next to the tool line below to signal that you are working on it. Once merged into the feature-branch, check the checkbox.
Tasks/milestones: