diff --git a/.github/dependabot.yml b/.github/dependabot.yml
index 00079caf1..90ec55f74 100644
--- a/.github/dependabot.yml
+++ b/.github/dependabot.yml
@@ -18,10 +18,8 @@ updates:
- package-ecosystem: "maven"
directory: "/"
schedule:
- interval: "weekly"
- day: "friday"
+ interval: "quarterly"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
- interval: "weekly"
- day: "friday"
+ interval: "quarterly"
diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md
index 4cbe168c3..9ff35c83e 100644
--- a/.github/pull_request_template.md
+++ b/.github/pull_request_template.md
@@ -23,7 +23,7 @@ Before you push a pull request, review this list:
- [ ] Read the [contribution guidelines](CONTRIBUTING.md) for this project.
- [ ] Read the [ASF Generative Tooling Guidance](https://www.apache.org/legal/generative-tooling.html) if you use Artificial Intelligence (AI).
-- [ ] I used AI to create any part of, or all of, this pull request.
+- [ ] I used AI to create any part of, or all of, this pull request. Which AI tool was used to create this pull request, and to what extent did it contribute?
- [ ] Run a successful build using the default [Maven](https://maven.apache.org/) goal with `mvn`; that's `mvn` on the command line by itself.
- [ ] Write unit tests that match behavioral changes, where the tests fail if the changes to the runtime are not applied. This may not always be possible, but it is a best practice.
- [ ] Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml
index f8db33bf4..b7b7fdf05 100644
--- a/.github/workflows/codeql-analysis.yml
+++ b/.github/workflows/codeql-analysis.yml
@@ -37,6 +37,7 @@ jobs:
security-events: write
strategy:
+ max-parallel: 20
fail-fast: false
matrix:
language: [ 'java' ]
@@ -45,10 +46,10 @@ jobs:
steps:
- name: Checkout repository
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # 5.0.0
+ uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- - uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
+ - uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae #v5.0.5
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
@@ -57,7 +58,7 @@ jobs:
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
- uses: github/codeql-action/init@0499de31b99561a6d14a36a5f662c2a54f91beee # 3.29.5
+ uses: github/codeql-action/init@95e58e9a2cdfd71adc6e0353d5c52f41a045d225 # v4.35.2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
@@ -68,7 +69,7 @@ jobs:
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
- uses: github/codeql-action/autobuild@0499de31b99561a6d14a36a5f662c2a54f91beee # 3.29.5
+ uses: github/codeql-action/autobuild@95e58e9a2cdfd71adc6e0353d5c52f41a045d225 # v4.35.2
# âšī¸ Command-line programs to run using the OS shell.
# đ https://git.io/JvXDl
@@ -82,4 +83,4 @@ jobs:
# make release
- name: Perform CodeQL Analysis
- uses: github/codeql-action/analyze@0499de31b99561a6d14a36a5f662c2a54f91beee # 3.29.5
+ uses: github/codeql-action/analyze@95e58e9a2cdfd71adc6e0353d5c52f41a045d225 # v4.35.2
diff --git a/.github/workflows/dependency-review.yml b/.github/workflows/dependency-review.yml
index a657a4ae2..f0d8ca94e 100644
--- a/.github/workflows/dependency-review.yml
+++ b/.github/workflows/dependency-review.yml
@@ -26,6 +26,6 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: 'Checkout Repository'
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
+ uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: 'Dependency Review PR'
- uses: actions/dependency-review-action@40c09b7dc99638e5ddb0bfd91c1673effc064d8a # v4.8.1
+ uses: actions/dependency-review-action@2031cfc080254a8a887f58cffee85186f0e49e48 # v4.9.0
diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml
index f923232fc..0ac859b4a 100644
--- a/.github/workflows/maven.yml
+++ b/.github/workflows/maven.yml
@@ -15,7 +15,11 @@
name: Java CI
-on: [push, pull_request]
+on:
+ push:
+ branches:
+ - 'master'
+ pull_request: {}
permissions:
contents: read
@@ -26,25 +30,28 @@ jobs:
runs-on: ubuntu-latest
continue-on-error: ${{ matrix.experimental }}
strategy:
+ max-parallel: 20
matrix:
java: [ 8, 11, 17, 21, 25 ]
experimental: [false]
include:
- java: 26-ea
experimental: true
+# - java: 27-ea
+# experimental: true
steps:
- - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # 5.0.0
+ - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- - uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
+ - uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae #v5.0.5
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Set up JDK ${{ matrix.java }}
- uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165 # v5.0.0
+ uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5.2.0
with:
distribution: 'temurin'
java-version: ${{ matrix.java }}
diff --git a/.github/workflows/scorecards-analysis.yml b/.github/workflows/scorecards-analysis.yml
index 17444b765..16e37f605 100644
--- a/.github/workflows/scorecards-analysis.yml
+++ b/.github/workflows/scorecards-analysis.yml
@@ -40,7 +40,7 @@ jobs:
steps:
- name: "Checkout code"
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # 5.0.0
+ uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # 6.0.2
with:
persist-credentials: false
@@ -57,13 +57,13 @@ jobs:
publish_results: true
- name: "Upload artifact"
- uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
+ uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: SARIF file
path: results.sarif
retention-days: 5
- name: "Upload to code-scanning"
- uses: github/codeql-action/upload-sarif@0499de31b99561a6d14a36a5f662c2a54f91beee # 3.29.5
+ uses: github/codeql-action/upload-sarif@95e58e9a2cdfd71adc6e0353d5c52f41a045d225 # v4.35.2
with:
sarif_file: results.sarif
diff --git a/.gitignore b/.gitignore
index 979659713..5a3aaa1b2 100644
--- a/.gitignore
+++ b/.gitignore
@@ -23,3 +23,7 @@ site-content
*.iws
*.ipr
*.iml
+
+# NetBeans files
+nb-configuration.xml
+nbactions.xml
diff --git a/NOTICE.txt b/NOTICE.txt
index 10eb78eb4..a8fd7fbae 100644
--- a/NOTICE.txt
+++ b/NOTICE.txt
@@ -1,5 +1,5 @@
Apache Commons CLI
-Copyright 2002-2025 The Apache Software Foundation
+Copyright 2002-2026 The Apache Software Foundation
This product includes software developed at
The Apache Software Foundation (https://www.apache.org/).
diff --git a/pom.xml b/pom.xml
index ec44cb737..c72373871 100644
--- a/pom.xml
+++ b/pom.xml
@@ -19,7 +19,7 @@
org.apache.commonscommons-parent
- 91
+ 984.0.0commons-cli
@@ -74,7 +74,7 @@
org.apache.commonscommons-text
- 1.14.0
+ 1.15.0test
@@ -91,12 +91,12 @@
1.8cliorg.apache.commons.cli
- 1.11.0
- 1.11.1
+ 1.11.1
+ 1.11.2commons-cli-${commons.release.version}trueRC1
- 1.10.0
+ 1.11.0org.apache.commons.cliCLI12310463
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 269763f54..408890c49 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -22,6 +22,16 @@
Apache Commons CLI Release Notes
+
+
+ Fix broken Introduction links on the website #417.
+ Fix malformed Javadoc comments.
+ Correct HelpFormatter Javadoc #418.
+
+
+ Bump org.apache.commons:commons-parent from 91 to 98 #414, #416.
+ [test] Bump org.apache.commons:commons-text from 1.14.0 to 1.15.0.
+ Multiple trailing BREAK_CHAR_SET characters cause infinite loop in HelpFormatter.
diff --git a/src/main/java/org/apache/commons/cli/AmbiguousOptionException.java b/src/main/java/org/apache/commons/cli/AmbiguousOptionException.java
index d38a81ccc..86cefd19a 100644
--- a/src/main/java/org/apache/commons/cli/AmbiguousOptionException.java
+++ b/src/main/java/org/apache/commons/cli/AmbiguousOptionException.java
@@ -26,6 +26,7 @@ Licensed to the Apache Software Foundation (ASF) under one or more
* @since 1.3
*/
public class AmbiguousOptionException extends UnrecognizedOptionException {
+
/**
* This exception {@code serialVersionUID}.
*/
diff --git a/src/main/java/org/apache/commons/cli/CommandLine.java b/src/main/java/org/apache/commons/cli/CommandLine.java
index 477903e7d..d0ca1fc5a 100644
--- a/src/main/java/org/apache/commons/cli/CommandLine.java
+++ b/src/main/java/org/apache/commons/cli/CommandLine.java
@@ -267,9 +267,9 @@ public int getOptionCount(final String optionName) {
/**
* Gets the {@code Object} type of this {@code Option}.
*
- * @deprecated due to System.err message; use {@link #getParsedOptionValue(char)} instead.
* @param optionChar the name of the option.
* @return the type of opt.
+ * @deprecated due to System.err message; use {@link #getParsedOptionValue(char)} instead.
*/
@Deprecated
public Object getOptionObject(final char optionChar) {
diff --git a/src/main/java/org/apache/commons/cli/DefaultParser.java b/src/main/java/org/apache/commons/cli/DefaultParser.java
index da7960b3d..637009832 100644
--- a/src/main/java/org/apache/commons/cli/DefaultParser.java
+++ b/src/main/java/org/apache/commons/cli/DefaultParser.java
@@ -157,24 +157,28 @@ public Builder setStripLeadingAndTrailingQuotes(final Boolean stripLeadingAndTra
}
/**
- * Enum representing possible actions that may be done when "non option" is discovered during parsing.
+ * Enumerates possible actions that may be done when "non option" is discovered during parsing.
*
* @since 1.10.0
*/
public enum NonOptionAction {
+
/**
* Parsing continues and current token is ignored.
*/
IGNORE,
+
/**
* Parsing continues and current token is added to command line arguments.
*/
SKIP,
+
/**
* Parsing will stop and remaining tokens are added to command line arguments.
* Equivalent of {@code stopAtNonOption = true}.
*/
STOP,
+
/**
* Parsing will abort and exception is thrown.
* Equivalent of {@code stopAtNonOption = false}.
diff --git a/src/main/java/org/apache/commons/cli/HelpFormatter.java b/src/main/java/org/apache/commons/cli/HelpFormatter.java
index fb9da62e9..8873addab 100644
--- a/src/main/java/org/apache/commons/cli/HelpFormatter.java
+++ b/src/main/java/org/apache/commons/cli/HelpFormatter.java
@@ -44,9 +44,9 @@ Licensed to the Apache Software Foundation (ASF) under one or more
*
*
* Options options = new Options();
- * options.addOption(OptionBuilder.withLongOpt("file").withDescription("The file to be processed").hasArg().withArgName("FILE").isRequired().create('f'));
- * options.addOption(OptionBuilder.withLongOpt("version").withDescription("Print the version of the application").create('v'));
- * options.addOption(OptionBuilder.withLongOpt("help").create('h'));
+ * options.addOption(Option.builder("f").longOpt("file").desc("The file to be processed").hasArg().argName("FILE").required().get());
+ * options.addOption(Option.builder("v").longOpt("version").desc("Print the version of the application").get());
+ * options.addOption(Option.builder("h").longOpt("help").get());
*
* String header = "Do something useful with an input file\n\n";
* String footer = "\nPlease report issues at https://example.com/issues";
@@ -67,6 +67,7 @@ Licensed to the Apache Software Foundation (ASF) under one or more
*
* Please report issues at https://example.com/issues
* }
+ *
* @deprecated Use {@link org.apache.commons.cli.help.HelpFormatter}.
*/
@Deprecated
@@ -146,6 +147,7 @@ public Builder setShowDeprecated(final Function