Tarun4201 opened a new pull request, #13277:
URL: https://github.com/apache/maven/pull/13277
### Summary & Rationale
Maven contains multiple standalone CLI entry points (e.g. `mvn`, `mvnenc`,
`mvnsh`, `mvnup`). Currently, any extra tools and their dependencies must be
bundled into Maven's shared `${maven.home}/lib/` directory, causing lib
directory bloat and potential version conflicts among third-party CLI tools.
**Maven CLAPP** (Command Line App) resolves this by allowing extra Maven CLI
tools to maintain their private dependencies in an isolated directory structure
under `${maven.home}/lib/clapp/<toolName>/`.
---
### Key Changes Implemented
#### 1. New Entry Point: `MavenClappCling`
- Added `MavenClappCling.java` under `org.apache.maven.cling`.
- - Implements class-loader isolation by scanning
`${maven.home}/lib/clapp/<toolName>/` for `*.jar` files and constructing a
child `URLClassLoader` that inherits from the core Maven class-loader.
- - Reads the tool entry point (e.g. `mainClass`) and delegates invocation
to `main(String[] args, ClassWorld world)`.
- - Falls back to `MavenCling` if no specific CLAPP tool parameters are
provided.
#### 2. Configuration & Class-Realm Updates
- **`m2.conf`**: Added `optionally
${maven.home}/lib/clapp/${maven.clapp.name}/*.jar` so Plexus ClassWorlds
includes tool-specific dependencies dynamically when `maven.clapp.name` is
configured.
- - **`component.xml`**: Updated the distribution assembly descriptor to
include `lib/clapp/` in binary releases.
#### 3. Launcher Script Enhancements
- **`mvn`**:
- - Added support for `--clapp <toolName>` and `--clapp=<toolName>`.
- - Added `_load_clapp_main_class()` function to look up `mainClass` in
`${maven.home}/lib/clapp/<toolName>/clapp.properties`.
- - Passes system properties `-Dmaven.clapp.name` and
`-Dmaven.clapp.mainClass` to the JVM invocation.
#### 4. Documentation & Unit Tests
- **Directory Structure & README**: Created `lib/clapp/README.txt`
explaining the directory layout and `clapp.properties` format.
- - **Unit Testing**: Added `MavenClappClingTest.java` covering jar
discovery, error conditions, and missing configurations.
Fixes #10316.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]