kerimovkhikmet opened a new issue, #11242: URL: https://github.com/apache/maven/issues/11242
### New feature, improvement proposal Currently, Maven downloads POM files for all dependencies, but only downloads JAR files when they are required for the build. This behavior causes issues when local Maven repositories are used by other build tools, such as sbt (via Ivy or Coursier), which often fail when a POM exists locally, but the corresponding JAR does not. **Proposed Feature:** Add a new CLI option, for example: ``` mvn dependency:resolve -DforceDownloadAllArtifacts=true ``` or ``` mvn -DdownloadAllArtifacts ``` When enabled, Maven should download both the POM and JAR files for every direct and transitive dependency defined in the project. **Use Case:** This feature would make local Maven repositories fully compatible with sbt and similar tools that expect both POM and JAR artifacts to exist locally. It would also help in offline builds and multi-tool environments where artifact completeness is critical. **Expected Behavior:** When the new flag is set, Maven should: * Resolve all dependencies (direct and transitive). * Download both POM and JAR files for each dependency. * Store them in the local repository, regardless of whether the build currently needs the JAR. **Motivation:** This feature would prevent inconsistent local repository states that currently lead to missing JAR resolution failures in sbt’s Ivy or Coursier-based dependency resolution. It would also provide a more predictable and complete local cache for cross-build-tool interoperability. As noted in the Coursier's [documentation](https://get-coursier.io/docs/other-repositories): ``` Avoid using ~/.m2/repository as a repository if you can. This is maven's internal file-system cache and it's not meant to be read by external tools. By using it you are risking running into some issues like e.g. directories with POMs inside but without corresponding jar files. You can read more about it here and here. ``` This highlights a real and recurring issue caused by Maven’s current behavior. Adding an option to force JAR downloads would eliminate such inconsistencies and improve interoperability across tools. -- 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]
