Hiteshsai007 commented on PR #12745:
URL: https://github.com/apache/maven/pull/12745#issuecomment-5314879582

   Hi @desruisseaux, I completely agree that Maven 4's improvements to Java 
Modules are going to be a game changer, and lowering that barrier to entry is 
incredibly important!
   
   While using JPMS as an incentive for better encapsulation is an interesting 
idea, there are a few reasons why providing `api`/`compile` at the POM level 
remains highly valuable:
   
   1. **The Migration Reality:** For many large or legacy projects, migrating 
to JPMS isn't just a matter of build-tool friction—it's blocked by legacy 
frameworks, heavy classpath scanning, or third-party dependencies that aren't 
JPMS-ready. Telling these developers they can't have compile-time isolation or 
incremental build performance improvements until they fully modularize their 
stack might push them away from Maven entirely, rather than toward JPMS (often 
toward Gradle, where `api`/`implementation` is the default).
   2. **Build Performance (Avoid Cascading Recompilations):** The build tool 
needs to know about `api` vs `compile` (implementation) *before* the compiler 
even runs. By knowing that a dependency is strictly an internal implementation 
detail (`compile`), Maven can intelligently prune the compile 
classpath/module-path for downstream consumers. This prevents cascading 
recompilations in large multi-module reactor builds when an internal dependency 
changes. 
   3. **A Stepping Stone to JPMS:** Rather than being redundant, these scopes 
can actually *assist* the transition to JPMS. If developers start modeling 
their dependencies logically with `api` and `compile` in their POMs today, 
Maven (or plugins) could eventually use that metadata to auto-generate, 
validate, or scaffold `module-info.java` files (`compile` -> `requires`, `api` 
-> `requires transitive`), making the eventual JPMS migration much smoother.
   
   In short, bringing this feature to Maven provides immediate correctness and 
performance benefits to the entire ecosystem today, while laying a cleaner 
foundation for those who will migrate to Java Modules tomorrow.
   
   


-- 
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]

Reply via email to