Maven Check Versions
Is a Python package designed for analyzing Maven POM files and managing dependencies. It checks the versions of dependencies in a project and identifies the latest available versions in Maven repositories. Developed for developers, this package simplifies dependency management in Maven-based projects. It is especially useful in CI/CD environments, where maintaining consistency and up-to-date dependencies is critical.
Features
- Dependency Analysis: Parses Maven POM files to analyze dependencies and plugins.
- Version Checking: Identifies outdated dependencies and checks versions against customizable thresholds.
- Artifact Search: Finds specific artifacts using
groupId:artifactId:versionformat. - Repository Support: Integrates with HTTP-based Maven repositories, including REST services.
- Module Processing: Processes nested modules in Maven projects.
- Caching: Caches results for faster rechecks.
- Logging: Provides configurable logging for detailed analysis.
- Command-Line Interface: Easily integrates into CI/CD pipelines.
Installation
You can install the tool via pip:
pip install maven_check_versions
Usage
- Analyze a specific pom file:
maven_check_versions --pom_file path/to/pom.xml
- Search for a specific artifact:
maven_check_versions --find_artifact com.example:my-lib:1.0
- Enable CI mode to suppress prompts:
maven_check_versions --ci_mode
Docker image
Pull image from GitHub:
docker pull ghcr.io/alexundros/maven-check-versions
Or pull image from DockerHub:
docker pull alexundros/maven-check-versions
- Analyze a specific pom file:
docker run --rm -v 'path/to/pom.xml:/app/pom.xml' alexundros/maven_check_versions -pf /app/pom.xml
- Search for a specific artifact:
docker run --rm alexundros/maven_check_versions -fa com.example:my-lib:1.0
- Enable CI mode to suppress prompts:
docker run --rm alexundros/maven_check_versions -ci
Command-Line Arguments
General Options
| Parameter | Short | Description | Example |
|---|---|---|---|
--ci_mode |
-ci |
Enables CI (Continuous Integration) mode. Suppresses prompts and waits for user input. | --ci_mode |
--pom_file |
-pf |
Specifies the path to the Maven POM file to process. | --pom_file path/to/pom.xml |
--find_artifact |
-fa |
Searches for a specific artifact. Provide the artifact in groupId:artifactId:version format. |
--find_artifact com.example:lib:1.0 |
Cache Control
| Parameter | Short | Description | Example |
|---|---|---|---|
--cache_off |
-co |
Disables caching to force fresh dependency checks. | --cache_off |
--cache_file |
-cf |
Specifies a custom path for the cache file. | --cache_file my_cache.json |
--cache_time |
-cf |
Specifies the cache expiration time in seconds. | --cache_time 1800 |
Logging Options
| Parameter | Short | Description | Example |
|---|---|---|---|
--logfile_off |
-lfo |
Disables logging to a file. Logs will only be shown in the terminal. | --logfile_off |
--log_file |
-lf |
Specifies the path to a custom log file. | --log_file my_log.log |
Configuration Options
| Parameter | Short | Description | Example |
|---|---|---|---|
--config_file |
-cfg |
Specifies a custom configuration file for the script. | --config_file config.cfg |
Error Handling and Validation
| Parameter | Short | Description | Example |
|---|---|---|---|
--fail_mode |
-fm |
Enables "fail mode." The script will terminate if dependency versions exceed specified thresholds. | --fail_mode |
--fail_major |
-mjv |
Specifies the major version difference threshold for failure. | --fail_major 1 |
--fail_minor |
-mnv |
Specifies the minor version difference threshold for failure. | --fail_minor 2 |
Dependency Search and Processing
| Parameter | Short | Description | Example |
|---|---|---|---|
--search_plugins |
-sp |
Includes Maven plugins in the dependency search process. | --search_plugins |
--process_modules |
-sm |
Processes modules listed in the POM file. | --process_modules |
--show_skip |
-sk |
Logs dependencies that are skipped. | --show_skip |
--show_search |
-ss |
Logs information about search actions. | --show_search |
--empty_version |
-ev |
Allows processing of dependencies without a version specified. | --empty_version |
--show_invalid |
-si |
Logs information about invalid dependencies. | --show_invalid |
Performance Options
| Parameter | Short | Description | Example |
|---|---|---|---|
--threading |
-th |
Enables multi-threading to process dependencies and modules concurrently. | --threading |
--max_threads |
-mt |
Specifies the maximum number of threads to use when threading is enabled. | --max_threads 8 |
Authentication
| Parameter | Short | Description | Example |
|---|---|---|---|
--user |
-un |
Specifies a username for basic authentication when accessing repositories. | --user my_username |
--password |
-up |
Specifies a password for basic authentication when accessing repositories. | --password my_password |
Configuration
You can customize the tool’s behavior using a configuration file maven_check_versions.cfg or maven_check_versions.yml. The following settings can be adjusted:
- SSL Verification: Enable or disable SSL verification for HTTP requests.
- Cache Preferences: Control cache duration and behavior.
- Repository Settings: Define base URLs, authentication, and paths for repositories.
- Logging Preferences: Specify log levels and file paths.
Example configuration
maven_check_versions.yml:
base:
cache_off: false
cache_time: 600
fail_mode: false
fail_major: 0
fail_minor: 0
search_plugins: false
process_modules: false
show_skip: false
show_search: false
empty_version: false
show_invalid: false
skip_version: true
threading: false
max_threads: 8
user: "USER"
password: "PASSWORD"
pom_http:
auth: true
urllib3:
warnings: true
requests:
verify: true
pom_files:
pom-name: "path/to/pom.xml"
repositories:
"Central (repo1.maven.org)": "repo1.maven"
repo1.maven:
base: "https://repo1.maven.org"
path: "maven2"
auth: false
maven_check_versions.cfg:
[base]
cache_off = false
cache_time = 600
fail_mode = false
fail_major = 0
fail_minor = 0
search_plugins = false
process_modules = false
show_skip = false
show_search = false
empty_version = false
show_invalid = false
skip_version = true
threading = false
max_threads = 8
user = USER
password = PASSWORD
[pom_http]
auth = true
[urllib3]
warnings = true
[requests]
verify = true
[pom_files]
pom-name = path/to/pom.xml
[repositories]
Central (repo1.maven.org) = repo1.maven
[repo1.maven]
base = https://repo1.maven.org
path = maven2
auth = false
Environment Variables
The tool supports environment variables to override configuration settings or provide credentials for external services. Below is a list of supported environment variables:
Configuration Overrides
These variables override settings from the maven_check_versions.cfg/maven_check_versions.yml file or command-line arguments. The format is CV_<KEY> where <KEY> corresponds to a configuration key in the base section (case-insensitive).
| Variable | Description | Example Value |
|---|---|---|
CV_CACHE_OFF |
Disables caching if set to true. |
true |
CV_CACHE_TIME |
Sets cache expiration time in seconds. | 3600 |
CV_FAIL_MODE |
Enables fail mode if set to true. |
true |
CV_FAIL_MAJOR |
Sets the major version threshold for failure. | 1 |
CV_FAIL_MINOR |
Sets the minor version threshold for failure. | 2 |
CV_SEARCH_PLUGINS |
Enables searching plugins if set to true. |
true |
CV_PROCESS_MODULES |
Enables processing of modules if set to true. |
true |
CV_SHOW_SKIP |
Logs skipped dependencies if set to true. |
true |
CV_SHOW_SEARCH |
Logs search actions if set to true. |
true |
CV_EMPTY_VERSION |
Allows empty versions if set to true. |
true |
CV_SHOW_INVALID |
Logs invalid dependencies if set to true. |
true |
CV_THREADING |
Enables multi-threading if set to true. |
true |
CV_MAX_THREADS |
Sets the maximum number of threads to use when threading is enabled. | 8 |
CV_USER |
Specifies the username for repository authentication. | my_username |
CV_PASSWORD |
Specifies the password for repository authentication. | my_password |
Usage Example
To override cache settings:
export CV_CACHE_OFF=true
export CV_CACHE_TIME=1800
maven_check_versions --pom_file path/to/pom.xml
License
This project is licensed under the MIT License. See the LICENSE file for more details.
Metadata
Release files for maven-check-versions 0.0.9
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| maven_check_versions-0.0.9.tar.gz | 22.7 kB | Without provenance | Details for maven_check_versions-0.0.9.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| maven_check_versions-0.0.9-py3-none-any.whl | Python 3 | none | any | Details for maven_check_versions-0.0.9-py3-none-any.whl |
Total release size: 40.1 kB
Release files / maven_check_versions-0.0.9.tar.gz
| Download URL | maven_check_versions-0.0.9.tar.gz |
|---|---|
| Size | 22.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
976bbb348d0227697eb24cc9a045f5833c94d312d1570d38cbc734f5c6df4a81
|
|
BLAKE2b-256 checksum How to use checksums |
e5b434705ab13f8a2fee4b5ae74438a59c121809080a91294efc2448c5a0f293
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.2
|
Release files / maven_check_versions-0.0.9-py3-none-any.whl
| Download URL | maven_check_versions-0.0.9-py3-none-any.whl |
|---|---|
| Size | 17.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6a3fd07abfdc7a0a739d98575688345161a4f9d2d46b544237429f1be3be328e
|
|
BLAKE2b-256 checksum How to use checksums |
adaab97e0da628ac8d83d167524d56a66eb522d32ccb0fd0a196e8e4d6f443e6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.2
|
Security for maven-check-versions 0.0.9
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.